How to code a field to be required | Community
Skip to main content
ReluctantProgrammer
Level 4
Sep 28, 2022 3:50 PM UTC
Solved

How to code a field to be required

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.
radzmar
radzmarAccepted solution
Level 10
Sep 28, 2022 4:33 PM UTC

You can set the mandatory property via script.

 

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

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

 

2 replies

radzmar
radzmarAccepted solution
Level 10
Sep 28, 2022 4:33 PM UTC

You can set the mandatory property via script.

 

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

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

 

Translate
ReluctantProgrammer
Level 4
Sep 28, 2022 4:55 PM UTC

Worked perfectly!

 

Thanks so much!

Translate