How to set field mandatory through client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2018 03:18 AM
Hi,
I know that g_form.setmandatory('fieldname'); //to set field mandatory in client script but i dont know how to create client script please can any one will help with screen short that how can we use client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 10:56 AM
You can check all the information here: Client scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 10:57 AM
Are you trying to set the field mandatory onLoad() or onChange() ? Below are some useful links for your query.
Client side script for setting mandatory variables (g_form.setMandatory)
Make field mandatory using client script
Please hit correct based on impact of response.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2018 10:58 AM
A) It would be g_form.setMandatory('fieldname', true);
B) It is easier to use UI Policies to govern this unless there is a specific use case, like changes from a state to another state
C) There are tons of examples in the OOB SN, like:
D) Please refer to the docs site for more info: GlideForm - Client
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2018 02:08 AM
It's not stated in your original post what you would actually like to make mandatory.
As Mike Allen said it is best configuring UI Policies and setting conditions on which fields you wish to make mandatory. Much easier.