- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 03:56 AM
Hi,
I am trying to make attachment widget mandatory only if the request type is add access.
So I have created a UI policy, and chose to set mandatory and set visible, the visible bit works but it does not set it mandatory however.
How can i create an onsubmit or onchange client script to make this field mandatory or prevent submission if no attachments.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 04:44 AM
I used the below script provided by
function onSubmit() {
if (this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage(getMessage('attachment_mandatory'));
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 04:00 AM
Catalog Client Script Code:
Script Include Code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 04:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 04:44 AM
I used the below script provided by
function onSubmit() {
if (this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage(getMessage('attachment_mandatory'));
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2024 12:30 AM
Hello,
In this, Where are you selecting your choice value?
Like,
var x = g_form.getValue('your_varaible');
if(x == 'add access'){
// then script here
}
I have similar situation & this solution isn't helping.
However I created a new variable, type attachment which is mandatory & visible only when certain choice is selected.