title: Google forms app script form validation of existing field
body: <p>I am trying to add a validation into an existing Google Form. I was already able to identify the item ID of the field I want to add a validation. I am just doing first the very basic requireTextContainsPattern in my text validation. I tried to follow <a href="https://developers.google.com/apps-script/reference/forms/text-validation" rel="nofollow noreferrer">https://developers.google.com/apps-script/reference/forms/text-validation</a></p>
  <pre><code> function validationTest() {
      var form = FormApp.openById('formID');
          var item = form.getItemById(itemID);
  
          var textValidation = FormApp.createTextValidation()
            .setHelpText(&quot;Enter email address&quot;)
            .requireTextContainsPattern(&quot;info@example.com&quot;)
            .build();
      
           item.setValidation(textValidation);
  </code></pre>
  <p>When I debug my code, I am getting</p>
  <pre><code>TypeError: item.setValidation is not a function
  </code></pre>
  <p>My question is: 1) How do I get this textvalidation into my the existing field in Google Form? 2) Is the error I am getting related to my question no. 1? But primarily, I wanted to resolve no. 1.
  Thanks in advance!</p>