Expand my Community achievements bar.

SOLVED

How to code a field to be required

Avatar

Level 5

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 

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can set the mandatory property via script.

 

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

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

 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

You can set the mandatory property via script.

 

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

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