Best approach to hide all variables and Submit option in Catalog Form of Record Producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 07:16 AM
I have a requirement when a specific choice is selected from a variable in a catalog form of record producer to show Info Message and hide all variables and Submit option from the form.
What is the best approach to do ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 07:22 AM - edited 07-20-2025 07:35 AM
Hi @vivek11
the fields can be hidden after a specific conditions selected in a variable by a catalog client script or catalog ui policy.
but if you will be adding addInfoMessage() it is better with the onChange catalog client script.
The Submit button cannot be hidden after some specific values in variables, you can hide it always or never. But you can write onSubmit catalog client script, which will just abort the submission, it can be together with an error message:
var yourField1 = g_form.getValue('variable_name1');
var yourField2= g_form.getValue('variable_name2');
var yourField3 = g_form.getValue('variable_name3');
if ((yourField == 'not_allowed_value') || (yourField2 == 'not_allowed_value') || (yourField3 == 'not_allowed_value')) {
g_form.addErrorMessage('Your text);
reutrn false; //abort of submit
} else {
return true; //submit ok
}
Prepare a draft of the code and share it for a review
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 07:22 AM
Hi Vivek,
I am wondering in what case you would have a record that you can select after which you would disable it and make the form not be able to submit.
I guess you would then want to hide the variable anyhow and maybe make a notification for that question.
Otherwise, I would suggest just using alert("Lorem ipsum!");
.
Regards,
Jaap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 07:31 AM - edited 07-20-2025 07:31 AM
@Jaap you can write onSubmit catalog client script with a condition:
var yourField = g_form.getValue('variable_name');
if (yourField == 'not_allowed_value') {
g_form.addErrorMessage('Your text);
reutrn false;
} else {
return true;
}
This can be to enforce mandatory attachment only with some combination of values, not always... you add attachment type variable and with this onSubmit script you add a condition. Or it can be any other scenario
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 09:17 AM
Hello @vivek11, if there are many variables to hide, then you can plan UI policy. But, while hiding variables, ensure that those are non-mandatory.
To hide submission of catalog item dynamically, you may have to think of manipulating the DOM, which is not advisable, so please re-verify. Rather, you can stop the item submission by writing a simple 'On Submit' client script something like this
function onSubmit() {
g_form.addErrorMessage('You cannot submit this item with the selected choice; change the choice');
return false;
}
Regards,
Nishant