1
votes

I have a Google sheet -"A". A google form- "B" and google form response sheet- "C". There is a date mentioned in "A". Form "B" asks for many responses, out of which date is one of them.

Logic:- Before submitting the form "B", I want to make sure that the date entered by user is greater than the date already mentioned in "A".

If logic is true submit form. Else display- form can not be submitted.

I can extract date from sheet "A". But I am not able to push or read or validate date entry done in form "B".

I am writing the script in Google forms.

function datevalidate() {
  var Sheet= SpreadsheetApp.openById("avbchfhlhasf").getSheetByName("Booking");
  var Origdate= Sheet.getRange(2, 9).getValues()[0];

  var form = FormApp.openById("jhkjdshfkjasdfk");
  var item= form.getItems(FormApp.ItemType.DATE);

  Logger.log(item[0]);


  }

i expect the date of "B"- in code "item " to be validated with date of "A" in code "Origdate"- BEFORE submitting the form.

1
Not possible with Google forms. Use custom made html form, if needed.TheMaster
how to make custom html forms that can have my application?Apurb
You can make a custom html form in a Web App (developers.google.com/apps-script/guides/web). Here is an example of html form and how they communicate with the code.gs: developers.google.com/apps-script/guides/html/communication.Andres Duarte
I believe there is a solution. Please share a link to a sample form heaving the date question to be validated .marikamitsos

1 Answers

0
votes

Currently, validation can only be set to text fields and checkboxes.

Might I recommend creating 3 separate fields (one for date, month & year), then apply validation rules to each of these independently?