- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2024 02:26 PM
Please I have a requirement to display an error message "Must provide a reason(s) for your selection".
We have a variable of type "SELECT BOX" with options: True, False, Unknown. So, when a user select "False" from these options, the above error message (in red color) must automatically display to users. Please how do I do this?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 09:08 PM
You can make use of an On-Submit Catalog Client Script. Please refer below screenshots :
function onSubmit() {
var userChoice = g_form.getValue('user_choice'); // Please replace with your catalog variable
if (userChoice == 'false') {
g_form.addErrorMessage('Please provide a reason for your selection before submitting');
return false;
}
}
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2024 09:26 PM
Hi @ID NOBLE
As requested by @AshishKM , you need to provide more details so that we can assist you further. Although, you can refer below reference example in which I have made use of a UI Policy to set field message on selection of a particular choice ( in your case, false) in a catalog item.
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 10:19 AM
Thank you, when I used this method, the error message displayed, but I was still able to submit the form which we don't want. Please what more should I add to make the user(s) unable to submit the form unless they meet the specified condition?
I really appreciate your support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 09:08 PM
You can make use of an On-Submit Catalog Client Script. Please refer below screenshots :
function onSubmit() {
var userChoice = g_form.getValue('user_choice'); // Please replace with your catalog variable
if (userChoice == 'false') {
g_form.addErrorMessage('Please provide a reason for your selection before submitting');
return false;
}
}
Please mark this response as correct and helpful if it assisted you with your question.