- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2022 02:42 AM
Hi Experts,
Can anyone help with the below requirement ?
While entering ay value in Single line text of a catalog item. If that contains a word call "NCX" at any place then we should display an error stating NCX VM is not available.
Example: 7878ty-NCX99769 - This should display error
Thanks in Advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2022 02:57 AM
Hello MC,
Please check with below code:
You can create onSubmit or onChange Catalog client script as per your requirement.
if you want that user should not be able to submit the form with "NCX" in that field then use onSubmit
if you want a validation when user change the field value then use the onChange catalog client script and you can show the error message.
function onSubmit() {
var fieldValue = g_form.getValue("your_field_name");
if (fieldValue.indexOf("NCX") >= 0) {
g_form.showFieldMsg("your_field_name", "NCX not allowed", "error"); // if you want to show error message on field
g_form.addErrorMessage("NCX not allowed");
return false;
}
}
Please mark this as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2022 02:57 AM
Hello MC,
Please check with below code:
You can create onSubmit or onChange Catalog client script as per your requirement.
if you want that user should not be able to submit the form with "NCX" in that field then use onSubmit
if you want a validation when user change the field value then use the onChange catalog client script and you can show the error message.
function onSubmit() {
var fieldValue = g_form.getValue("your_field_name");
if (fieldValue.indexOf("NCX") >= 0) {
g_form.showFieldMsg("your_field_name", "NCX not allowed", "error"); // if you want to show error message on field
g_form.addErrorMessage("NCX not allowed");
return false;
}
}
Please mark this as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2022 09:20 PM
Hello MC,
Just wanted to check with you, if the my above response answered your question. If yes, then please do close this thread/question my marking the appropriate response as correct.
If you still need any further help or guidance on this then please update those on this question.
Thanks