- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2023 03:26 AM
Hi ,
In catalog form, we are unable to add multiple attachments due to one catalog client script, if we are adding more than one attachment it is giving us the error as "Please attach the necessary attachment" as we have configured in catalog client script as it is taking only one attachment
i have changed some changes to script but its not working fine
Pasting the onsubmit catalog client script here which we are using for this catalog form
Please help me to resolve this issue like in script where i am going incorrect
Onsubmit catalog client script :
function onSubmit() {
var typeCondition = 0;
var topic = g_form.getValue('u_topic');
if (topic == "I have an overpayment" || topic == "I have an underpayment" || topic == "I have not received any payment" || topic == "Resignations/terminations" || topic == "I can't access my payslip" || topic == "Add/remove beneficiaries Colmedica" || topic == "Add tax relief"|| topic == "Change of hierarchy"|| topic == "Request bank account change"|| topic == "Request cesantias") {
typeCondition = 1;
}
var reqAttachments = typeCondition;
if (reqAttachments > 0) {
try {
var attachments = document.getElementsByClassName('attachment_list_items');
if (attachments.length - 1 != reqAttachments) {
alert('Please attach the necessary attachment');
return false;
}
} catch (e) {
var count = getSCAttachmentCount();
if (count != reqAttachments) {
alert('Please attach the necessary attachment');
return false;
}
}
}
}
@Peter Bodelier @AnveshKumar M @Vishal Birajdar
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2023 03:36 AM
Hi @sri vijaya,
You are checking if the count of attachments is the same as the required amount. You should check if it's at least the required amount;
function onSubmit() {
var typeCondition = 0;
var topic = g_form.getValue('u_topic');
if (topic == "I have an overpayment" || topic == "I have an underpayment" || topic == "I have not received any payment" || topic == "Resignations/terminations" || topic == "I can't access my payslip" || topic == "Add/remove beneficiaries Colmedica" || topic == "Add tax relief"|| topic == "Change of hierarchy"|| topic == "Request bank account change"|| topic == "Request cesantias") {
typeCondition = 1;
}
var reqAttachments = typeCondition;
if (reqAttachments > 0) {
try {
var attachments = document.getElementsByClassName('attachment_list_items');
if (attachments.length - 1 < reqAttachments) {
alert('Please attach the necessary attachment');
return false;
}
} catch (e) {
var count = getSCAttachmentCount();
if (count < reqAttachments) {
alert('Please attach the necessary attachment');
return false;
}
}
}
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2023 03:36 AM
Hi @sri vijaya,
You are checking if the count of attachments is the same as the required amount. You should check if it's at least the required amount;
function onSubmit() {
var typeCondition = 0;
var topic = g_form.getValue('u_topic');
if (topic == "I have an overpayment" || topic == "I have an underpayment" || topic == "I have not received any payment" || topic == "Resignations/terminations" || topic == "I can't access my payslip" || topic == "Add/remove beneficiaries Colmedica" || topic == "Add tax relief"|| topic == "Change of hierarchy"|| topic == "Request bank account change"|| topic == "Request cesantias") {
typeCondition = 1;
}
var reqAttachments = typeCondition;
if (reqAttachments > 0) {
try {
var attachments = document.getElementsByClassName('attachment_list_items');
if (attachments.length - 1 < reqAttachments) {
alert('Please attach the necessary attachment');
return false;
}
} catch (e) {
var count = getSCAttachmentCount();
if (count < reqAttachments) {
alert('Please attach the necessary attachment');
return false;
}
}
}
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.