1 Reply Latest reply on Nov 1, 2015 2:47 AM by try67

    Make a text field required based off any on dropdown field specific answer

    yohjp

      Hello,

      I been testing below in either adding a custom validation script to the event field or a custom calculation script to the target field, but can seem to do this in regards to more than one event field (more than one drop down selection).

       

      My situation is I have roughly 10-12 questions that are have dropdown selections. One answer is the same for all: "OTHER". If that is selected for any of the questions as an answer, I want to have a text field "Comments" required.

       

      How would I go about that assuming the field names for the questions are Q1,Q2,....and so on.

       

      The script I been using is as attempted to use for each dropdown selection field as a "custom calculation script"

       

      // Custom Validate script for combo box

      (function () {

       

          var f = getField("Comments");

          f.value = f.defaultValue;

       

          if (event.value === "OTHER") {

             f.display = display.visible;

             f.required = true;

          } else {

              f.display = display.visible;

              f.required = false;

      }  

      })();

       

      If I apply it to the proceeding dropdown selection, then now the previous selection doesn't force the Comment field to be required.