Google-forms – How to we NOT record, but on the fly disregard responses not matching an already existing roster

google-forms

We use google forms to send out tests to our students and must find a solution for the (as per title) following situation:

The scenario limitations:
NOT all our students can have a google account. We have to have the form public. We already have a spreadsheet (STU-INFO) with all our students' information.

Workflow:


A) Taking the test.
Using our existing STU-INFO we send an email to the students. The student receives an email.

Dear STUDENT,
There is a new test for you: CLICK HERE FOR "YOUR NEW TEST"
bla, bla, bla
Good luck

The student goes to the form and submits the test.


B) We would like the following:
When the student submits the form, the response gets "on-the-fly" auto checked whether the email submitted for the RESPONSES spreadsheet, matches one of the emails that already exist in our STU-INFO spreadsheet.
If the email matches, the respond gets recorded.
Otherwise the response should be discarded without even being recorded.
Ideally a pop-up message should be shown to the submitter. "Success!!!" OR "Sorry you are not registered for the test "YOUR NEW TEST" . Your answers are disregarded".
Worst case scenario? Instead of the pop-up {when the email does not match) an email is auto sent to the submitter with the test ID auto filled. "Sorry you are not registered for this test ID "YOUR NEW TEST". Your answers are disregarded."

I have little experience with scripts and the script editor in Google Sheets. As a final note, other add-ons (formmule, flubaroo and AutoCrat) also use the same RESPONSES Google Spreadsheet.


EDIT:
After reading the comment and answer left respectively by @Canadian Luke and @Ruben I feel I need to explain further why we do need such a function.

First of all we do give not one but two "warning" messages when students try to fill in their email addresses at the very beginning of the form.
The first one in the form of a hint: "ONLY REGISTERED students are allowed to take the test. ALL duplicate and/or unregistered responses will be discarded."
The second one comes as a custom message under Data Validation:
Data Validation–> Text–> Email address–> "Please make sure you type your registered email correctly so as to receive your grade"
About Ruben's answer. We have already tried and currently use pre-filled URL forms. The issue though is that (as explained in the beginning) the forms have to be public. Unregistered students, trying to be "funny" fill out the forms using pseudo-addresses anyway.

Best Answer

Short answer

Once the response is submitted it's stored and there isn't a way to avoid this. By the other side, it's not possible to delete individual responses on the responses container bounded to the Google Form.

Explanation

At this time Google Forms responses are stored in the Google form file and optionally could be set to automatically send them to a Google spreadsheet by using a built-in feature.

It's worth to say that Google Forms also could be used as a script container and that it have the event on form submit that could be used to do some things with the submitted responses like to discriminate which responses should be sent to a Google spreadsheet, but not for delete individual responses from the responses container bounded to the Google form file.

Remarks

As was already mentioned in a comment to the question by Canadian Luke, relying on students typing their ID in a Google Form and automatically discriminating their responses based on it could cause "problems". One way to minimize this is to send to each student the URL to a pre-filled Google Form with their ID already filled up.

References