how to check mandatory field using script?

Akki1
Tera Contributor

How can i check if the field is mandatory in client script?

8 REPLIES 8

Not applicable

Hi,

Use following code to get the list of Mandatory fields which are not filled by a user on the form in a client script.

 

var arr = g_form.getMissingFields();

 
Thanks!

@Community Alums 

Thanks

But I am not looking for checking all the fields.

I have a variable name on the catalog form and I want to check for that specific field only .

Not applicable

You might be better served by using a UI Policy. If any mandatory fields are left blank, the system will pop-up a message letting the user know which fields need to be populated.

Basheer
Mega Sage

Hi @Akki1 ,

In clientscript we have g_form.isMandatory('field_name'); it returns true if field is mandatory and false if field is non mandatory.

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.