Cemre MAVİOĞLU
Cemre MAVİOĞLU

Reputation: 1

Validating text item input in google script(for google forms)

when you are not using scripts, there is an option to put a condition for inputting e-mail adresses then making it a required question. Because I'm randomizing my test and refreshing it every minute I cant do this manually, is there a way to do this by script?

Upvotes: 0

Views: 1083

Answers (1)

Sameh Ayoub
Sameh Ayoub

Reputation: 29

Update: Google team implemented this feature. Check it out: https://developers.google.com/apps-script/reference/forms/data-validation-builder

Here is the ticket to add this feature: https://code.google.com/p/google-apps-script-issues/issues/detail?id=4216#makechanges

About make the item required, you can do it like this:

if (item.getType() == FormApp.ItemType.TEXT){
    var textItem = item.asTextItem();
    textItem.setRequired(true);
}

You can do that for any item type that can have answer. For the complete list of the Items types refer to this link: https://developers.google.com/apps-script/reference/forms/item-type#properties

Upvotes: 1

Related Questions