How to code a field to be required | Community
Skip to main content
ReluctantProgrammer
Level 4
September 28, 2022
Solved

How to code a field to be required

  • September 28, 2022
  • 1 reply
  • 920 views

I have a form which has 3 checkboxes that if checked then the corresponding text boxes becomes visible.  I also need each text box to be Required if it is visible; it should remain optional if the field remains hidden.  Is there a code for this?

 

BIP 126 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by radzmar

You can set the mandatory property via script.

 

//Make field mandatory
textfield.mandatory = "error";

// Make field optional
textfield.mandatory = "disabled";

 

1 reply

radzmar
radzmarAccepted solution
Level 10
September 28, 2022

You can set the mandatory property via script.

 

//Make field mandatory
textfield.mandatory = "error";

// Make field optional
textfield.mandatory = "disabled";

 

ReluctantProgrammer
Level 4
September 28, 2022

Worked perfectly!

 

Thanks so much!