client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
We need to list all the mandatory fields in the record using a client script (code)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @AK001025799
I think you can do this using an onLoad Client Script. I'm still learning, but this code worked for me.
function onLoad() {
var fields = g_form.getEditableFields();
var mandatory = [];
for (var i = 0; i < fields.length; i++) {
if (g_form.isMandatory(fields[i])) {
mandatory.push(g_form.getLabelOf(fields[i]));
}
}
alert("Mandatory Fields:\n" + mandatory.join("\n"));
}
This checks all the editable fields on the form and shows the mandatory field labels in an alert.
Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
No its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @AK001025799 ,
function onLoad() {
var mandatoryFields = [];
var elements = g_form.elements;
for (var i = 0; i < elements.length; i++) {
var fieldName = elements[i].fieldName || elements[i].name;
if (fieldName && g_form.isMandatory(fieldName)) {
mandatoryFields.push(fieldName);
}
}
console.log("Mandatory Fields:", mandatoryFields);
alert("Mandatory Fields:\n" + mandatoryFields.join("\n"));
}
Thanks,
Danish Bhairagdar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
59m ago