
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 08:20 AM
Hi all,
I have been looking to write an OnChange client script to make an attachment mandatory when a specific variable has changed. I don't want to use the onSubmit function.
I also don't want to enable 'Add Attachment' mandatory on the catalog item itself, only when a variable has been changed.
For example: When 'Supplier Updates' is selected, a new mandatory selectbox appears, if 'Address' is then selected from the next selectbox, another mandatory selectbox appears, if Remit is selected, this is where an attachment becomes mandatory.
I am not sure how to enable this in the onChange client script. Does anyone have any crafty ideas to make this dream a reality? Thanks!!
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 10:08 AM
Now corrected!
//catalog client script to check for attachement
function onSubmit() {
if((g_form.getValue('<variable name>') == 'yes') && this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage(getMessage('attachment_is_mandatory'));
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 10:02 AM
Below link might be helpful