Skip to main content
Participant
March 14, 2024
Answered

Set text field as required entry based on dropdown

  • March 14, 2024
  • 1 reply
  • 405 views

Help 

Am new to PDF scripting and I have a form which has a field called "New or Uplift" 

 

I currently have the script to :

If Uplift is selected a hidden field "Text8" then appears for free text to be entered.

If New is selected the hidden field stays hidden

and then the form is submitted via email as long as all the required fields are completed

 

I am trying to do a script and struggling where if Uplift is selected then the hidden field "Text8" converts to a required field and if "New" is selected then the hidden field stays as not required ?

This topic has been closed for replies.
Correct answer Nesa Nurani

As validate script of dropdown ("New or Uplift") field, use this:

this.getField("Text8").required = (event.value == "Uplift") ? true : false;

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
March 14, 2024

As validate script of dropdown ("New or Uplift") field, use this:

this.getField("Text8").required = (event.value == "Uplift") ? true : false;

Participant
March 14, 2024

Thank you Nesa - works perfectly