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
56m ago
pls remove the console.log line n try
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);
}
}
alert("Mandatory Fields:\n" + mandatoryFields.join("\n"));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
57m ago
@AK001025799
Can you please try using this:
function onLoad() {
var mandatoryFields = [];
var allFields = g_form.getFieldNames();
for (var i = 0; i < allFields.length; i++) {
var fieldName = allFields[i];
if (g_form.isMandatory(fieldName)) {
mandatoryFields.push(g_form.getLabelOf(fieldName));
}
}
g_form.addInfoMessage("Mandatory Fields: " + mandatoryFields.join(", "));
}
May be because if getEditableFields() is not supported in your instance it will not work.
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
53m ago
can you please send me the screenshot of your pdi ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
48m ago
HI @AK001025799 ,
Can you please share more info about your use case.
Where you want to display all mandatory fields?
When you want to display onLoad or onSubmit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
44m ago