Prevent from submitting form if already an event

Viewed 61

I am setting up a Google Form where the user can book up to 3 different machines by entering:

  • Machine name (drop-down list)
  • Start date
  • End date

I have already made the script that creates a Google Calendar event when the form is submitted.

Now, to avoid multiple bookings at the same time, I would like to make it impossible for the user (or at least send him a refusal message afterwards) to book a machine which is already booked (ie when there is already an existing event in the machine calendar).

How would it be possible to do so?

Thank you very much in advance for your help!

1 Answers

Unfortunately, there is no way you can prevent users from submitting form nor set refusal message(Confirmation Message) when an event already exists.

Based on Bryan P's answer here:

We can't conditionally set and immediately display a custom message for the current user's response based on what their answers were. The confirmation message is "front-loaded" in a sense.

There are alternative solutions you can use:

  • Send user an email after they submit a form and indicate whether they successfully book the event or not.
  • Instead of using Google Form, use Google Sheets Custom Side bar which you can create a form. Since Custom Side bar is created using HTML/javascript, you can prevent the user from submitting form or set a refusal message.

Further Reading:

Related