How to hide mandatory fields through client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2018 01:01 AM
How to hide mandatory fields through client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2018 01:05 AM
Hi Ram,
If there is a mandatory field you cant make it read only or hide it, so before you have to hide you make the field non mandatory.
Similarly, if a field is read only you cant make it mandatory, you first need to make it editable n then make it mandatory.
Regards,
Chandra Prakash

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2018 01:19 AM
Hi Ram,
Try with g_form.checkMandatory = false; to ignore all mandatory fields on the form.
Mark correct if it helps.
Regards,
Chandra Prakash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 02:06 AM
its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2018 01:45 AM
Hi Ram,
You have to write OnChange Client Script. Try with this Simple sample script below. You have to change the (field_name) accordingly.
function onChange(control, oldValue, newValue, isLoading, isTemplate)
{
if (isLoading || newValue === '')
{
return;
}
if(newValue == 'PUT THE FIELD VALUE HERE')
{
g_form.setMandatory('field_name', false);
g_form.setDisplay('field_name', false);
}
else
{
g_form.setMandatory('field_name', true);
g_form.setDisplay('field_name', true);
}
}
Let me know if you have any questions.
Please mark it Correct or Helpful, if it works based on impact....!!!!
Warm Regards,
Priyanka