- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team ,
We have a catalog item called “AWS Support”. Inside it, there is a variable called “Type of Request”.
One of the options for this variable is “Create AWS AD Group”.
If the user selects this option and tries to submit the form without adding an attachment, the form should not be submitted. Instead, the system should show an error message asking the user to attach the required file.
function onSubmit() {
var requestType = g_form.getValue('type_of_request');
if (requestType == 'Create AWS AD Group') {
var attachmentCount = g_form.getValue('attachments'); // this only works with attachment mandatory check in later versions
// For safer check - use g_form.hasAttachments() if your instance supports
if (!g_form.hasAttachments()) {
alert("Attachment is mandatory when selecting 'Create AWS AD Group'. Please attach a file before submitting.");
return false; // Prevent submission
}
}
return true;
}
the script which i have written it is not working - what was the error .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @nameisnani ,
"If the user selects this option and tries to submit the form without adding an attachment, the form should not be submitted. Instead, the system should show an error message asking the user to attach the required file."
It looks like - YOu want this field to be mandatory and when user is leaving blank, it should display error.
Regards,
Nikhil Bajaj
Regards,
Nikhil Bajaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @nameisnani ,
Just asking why you ar enot using - Ui Poilcy to make this field mandatory?
NOTE:- Please close all your previous threads/questions by making correct answers as- Solution accepted.
Regards,
Nikhil Bajaj
Regards,
Nikhil Bajaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @nameisnani ,
"If the user selects this option and tries to submit the form without adding an attachment, the form should not be submitted. Instead, the system should show an error message asking the user to attach the required file."
It looks like - YOu want this field to be mandatory and when user is leaving blank, it should display error.
Regards,
Nikhil Bajaj
Regards,
Nikhil Bajaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
"If the user selects this option and tries to submit the form without adding an attachment, the form should not be submitted. Instead, the system should show an error message asking the user to attach the required file." //// Yes , this is the one i am trying to achieve .
could you please tell what was the mistake in my script .
NOTE - I don't to make the filed mandtory .
It looks like - YOu want this field to be mandatory and when user is leaving blank, it should display error. // I am not looking for this .
hope you got my request