Get a list of all mandatory fields portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 01:59 AM
Hi All,
I want to get a list of all mandatory fields in the portal.
Does anyone know how to do it?
Thanks in advance 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 02:38 AM
I'm using a client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 02:58 AM
Hello @Snow Tomcal ,
In clientscript we have g_form.isMandatory('field_name'); it returns true if field is mandatory and false if field is non mandatory.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 03:51 AM
I need all the fields that are mandatory, not just one.😑
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 02:58 AM
Hello @Snow Tomcal
You can write a onLoad() Client Script :-
function onLoad() {
var fields = [];
for (var i = 0; i < g_form.elements.length; i++) {
if(g_form.isMandatory(g_form.elements[i].fieldName))
fields.push(g_form.elements[i].fieldName));
}
alert("Mandatory Fields are : "+fields);
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 03:50 AM
Now I get - TypeError: Cannot read property '0' of undefined.