Expand my Community achievements bar.

Changing field from "optional" to "required" in JS

Avatar

Former Community Member
What JS code do I use to change a field (i.e., text field) from "Optional" to "Required"?
4 Replies

Avatar

Former Community Member
Paul - I am trying to change the state of 'Type' on the 'Value' tab under the 'Object' tab (the 'Type' is 'User Entered - Required', 'User Entered - Recommended', User Entered - Optional' and so on) through JS. I want to change these Types in JS based on user selection of the form.

Avatar

Former Community Member
Found answer



This works:



textfield.mandatory = "disabled"; //Optional

textfield.mandatory = "error"; //Required