I am currently comparing a date input thru a google form by the user, against today's date, and I would like to stop the form data from being inserted into the google response spreadsheet if the date has not yet occurred. I've googled the heck out of this, but cannot find something similar to the DOM which has e.preventDefault(). Here is what my code looks like in the google script editor:
//first, verify the date of the submission is not before the date of the game (has not happened yet)
var todayDate = new Date();
var gameDate = new Date(ogkGameDate);
if (gameDate < todayDate)
{
//send an email to admin and user that submission was rejected because the game date is in the future.
var subject = "WFRA Online Game Keeping Submission";
var message = "Hello! Thank you for submitting to the online game keeping system. \n";
message += "\n Unfortunately, the submission was rejected because this game has not yet occurred:";
message +="\n Game Keeper: " + ogkGameKeeper;
message +="\n Game Date: " + gameDate;
message +="\n Submission Date: " + todayDate;
//message += "\n Administrators can view the submission sheet at " + ogkURL + " \n";
message += "\n Please reply to this email if you experience technical issues. \n";
// Send yourself an email with a link to the document.
GmailApp.sendEmail("wfringette@gmail.com", subject, message,{bcc: "thetroutlakemonster@gmail.com", replyTo: "webmaster@westferrisringette.ca"});
//reject the submission to the sheet
//HERE IS WHERE I WOULD LIKE TO CANCEL THE EVENT TO AVOID DATA INPUT TO THE SPREADSHEET
//exit the code
return; }
Thanks in advance for any advice!