Unable to submit form after one click on submit button
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2024 11:00 AM
Subject: Unable to submit form after one click on submit button
Description: The user has to click on Submit Button 3 times after updating the details to submit the form. If the Submit button is clicked once or twice, the form doesn't get submitted.
Issue is with the 2 on submit catalog client script, if we deactivate both the script form is getting submitted in one click only, can you please help here to understand what's went wrong in this script.
Script 1 Making some checkboxes mandatory for newzeland user
function onSubmit() {
// Making the checkboxes mandatory for New Zealand users
if (g_scratchpad.isFormValid)
return true;
var gdjUser = new GlideAjax('global.KHCatalogAjaxUtilsNewHire');
gdjUser.addParam('sysparm_name', 'checkNZUser');
gdjUser.addParam('sysparm_hrUser', g_user.userID);
gdjUser.getXMLAnswer(setAnswer);
return false;
function setAnswer(answer) {
if (answer == 'false') {
g_scratchpad.isFormValid = true;
} else {
var a = g_form.getBooleanValue('employment_contract_signed_by_employee');
var b = g_form.getBooleanValue('personal_details_form');
var c = g_form.getBooleanValue('tax_details_form');
if (a == false || b == false || c == false) {
g_form.addErrorMessage("Please check the checkbox for Employment contract signed by employee, Personal details and Tax details");
return false;
}
// var actionName = g_form.getActionName();
g_scratchpad.isFormValid = true;
g_form.submit();
}
}
}
Script 2 Making some checkboxes mandatory for austerilia user
function onSubmit() {
// Making the checkboxes mandatory for Australia users
if (g_scratchpad.isFormsValid)
return true;
var AU = new GlideAjax('global.KHCatalogAjaxUtilsNewHire');
AU.addParam('sysparm_name', 'checkAUUser');
AU.addParam('sysparm_hrUser', g_user.userID);
AU.getXMLAnswer(setAns);
return false;
function setAns(answer) {
if (answer == 'false') {
g_scratchpad.isFormsValid = true;
} else {
var a = g_form.getBooleanValue('employment_contract_signed_by_employ');
var b = g_form.getBooleanValue('personal_details_for');
var c = g_form.getBooleanValue('tax_file_declaration');
var d = g_form.getBooleanValue('super_form_smsf_attach_compliance_letter');
if (a == false || b == false || c == false || d == false) {
g_form.addErrorMessage("Please check the checkbox for Employment contract signed by employee, Personal details, Tax details and Super Form");
return false;
}
// var actionName = g_form.getActionName();
g_scratchpad.isFormsValid = true;
g_form.submit();
}
}
}
The above 2 causing the issue, But unable to understand the what's going wrong here.
Thanks
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 12:15 PM
provided script is allowing to submit form in One Click for other users,
But for New Zeland user's its not submitting the form its just loading and processing and for Australia user's form is submitting in one click without giving any error messages and even we not checked the checkboxes ,still form getting submitted. Ideally form should not be submit until we check the checkboxes
Thanks.