Pop up Mandatory attachment message based on condition
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:15 PM
Hi Community,
I have written below code for condition like when Data master is customer and Operation is New
the below code is not working for me, Could you please check and correct me where did i wrong
function onSubmit() {
//Type appropriate comment here, and begin script below
var data_master_val = g_form.getValue('data_master');
var opr_val = g_form.getValue('operation');
if (opr_val == "New") {
try {
var msg = 'Please attach the document before submitting this request';
var attachments = document.getElementById('header_attachment_list_label');
alert(msg);
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') {
alert(msg);
return false;
}
}
//For Service Portal
catch (e) {
var count = getSCAttachmentCount();
if (count <= 0) {
alert('msg');
return false;
}
}
}
}
Please check below screenshot more about the requirement
Regards
Srinivasu
//
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:19 PM
Sorry, this is the code i have written
function onSubmit() {
//Type appropriate comment here, and begin script below
var data_master_val = g_form.getValue('data_master');
var opr_val = g_form.getValue('operation');
if (data_master_val == 'Customer' && opr_val == 'New') {
try {
var msg = 'Please attach the document before submitting this request';
var attachments = document.getElementById('header_attachment_list_label');
alert(msg);
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') {
alert(msg);
return false;
}
}
//For Service Portal
catch (e) {
var count = getSCAttachmentCount();
if (count <= 0) {
alert('msg');
return false;
}
}
}
}
//
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:23 PM
Hello @Srinivasu2 ,
Are you getting alert message that you have put in try or catch block ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:33 PM
Hi Mohith,
No, I am not getting alert message
Regards,
Srinivasu