Abort on catalog request submission
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 08:34 AM
Hi,
I need to abort a submission of a request.
The submission must be aborted if a variable List collector contains a substring
I added a catalog Client Scripts - printscreen in attachment.
Issue:
even if the list collector contains "CyberArk", the request submission is not aborted.
Also, I need to display a message when submission is aborted
Kind regards,
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 09:17 AM
Hi @Sebastien C,
You're not far off, this can be easily tweaked to work as required.
FYI - the getDisplayValue() method is not valid. Instead, to get the value from a reference field, use the method g_form.getDisplayBox('your_field_name').value;
Here's a sample script you can adapt for you use that works as required:
function onSubmit() {
var value = g_form.getDisplayBox('your_field_name').value;
var contains = value.indexOf("string_to_match");
if (contains != '-1') {
g_form.clearMessages();
g_form.showErrorBox('your_field_name', 'Error message to display here');
return false;
} else {
return true;
}
}
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 11:40 PM
Hi Robbie,
I have that issue by use your code:
New client-scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype and the window object are likewise disabled. To disable this on a per-script basis, configure this form and add the "Isolate script" field. To disable this feature for all new globally-scoped client-side scripts set the system property "glide.script.block.client.globals" to false. And during the submission I have that alert: "There is a JavaScript error in your browser console" |