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

    Making a text box required using conditional formulas


      What code would I use to make a text box required based on conditional logic? For instance, I have a currency type and dollar amount. One of my logical arguments would be: "If currency type is PLN and the dollar amount is greater than or equal to 50,000 then make this text box a required field. Otherwise, make this field hidden"

        • 1. Re: Making a text box required using conditional formulas
          try67 MVP & Adobe Community Professional

          Since it depends on two fields you will either need to apply a script to both of these fields, or (perhaps a better option) use a hidden text field's custom calculation event to check both fields and then edit the third one.


          The code would look something like this:


          var f = this.getField("Text1"); // Replace with actual field name
          if (this.getField("Currency").value=="PLN" && Number(this.getField("Amount").value)>=50000) {
              f.display = display.visible;
              f.required = true;
          } else {
              f.display = display.hidden;
              f.required = false;
              f.value = "";