google-apigoogle-formsgoogle-forms-api

Google Form Api. Adding Response validation to textQuestion


Currently, AFAIK, when performing google form batchUpdate using the google forms API v1, we are only able to set the shuffle property of choiceQuestions, while for textQuestions there are no options to set the response validations, like if I want to use regex match as validation.

For Example, the request body looks like this:

{
  "requests": [
    {
      "createItem": {
        "item": {
          "questionItem": {
            "question": {
              "choiceQuestion": {
                "shuffle": false
              },
              "textQuestion": {
                "paragraph": false
                  /*no other parameters to set*/
              }
            }
          }
        }
      }
    }
  ]
}

Am I missing something? Or is this feature not implemented yet?


Solution

  • You are correct, this has not been implemented yet. For now, these are the only options that can be used with ChoiceQuestion This is kind of expected taking into consideration FORMS API was launched just last month.

    So you may want to submit a Feature Request for that missing feature.

    In the meantime, you can also consider tackling this using Google Apps Script and its Forms Advanced Service which includes response validation.