- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 08:26 AM
Hello All,
When i am calling server side code in client side onsubmit client script its throwing error scratchpad is not defined i am using isformValid method still i am facing issue.
Thanks in Advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 10:57 PM
Hi @Vikram Vasudev,
g_scratchpad.isFormValid is true. If it is, the form submission proceeds. Otherwise, it uses GlideAjax to make an asynchronous request and sets a callback function to handle the response. Upon receiving the response, it sets g_scratchpad.isFormValid to true and resubmits the form with the original actionName. This approach ensures that the asynchronous behavior doesn’t interfere with form submission.
function onSubmit() {
if (g_scratchpad.isFormValid){
return true;
}
var actionName = g_form.getActionName();
var ga = new GlideAjax("SOMEFUNCTION");
ga.addParam(.....);
ga.getXML(function() {
g_scratchpad.isFormValid = true;
g_form.submit(actionName);
});
return false;
}
Please mark it as solution proposed and helpful if it works for you.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 10:57 PM
Hi @Vikram Vasudev,
g_scratchpad.isFormValid is true. If it is, the form submission proceeds. Otherwise, it uses GlideAjax to make an asynchronous request and sets a callback function to handle the response. Upon receiving the response, it sets g_scratchpad.isFormValid to true and resubmits the form with the original actionName. This approach ensures that the asynchronous behavior doesn’t interfere with form submission.
function onSubmit() {
if (g_scratchpad.isFormValid){
return true;
}
var actionName = g_form.getActionName();
var ga = new GlideAjax("SOMEFUNCTION");
ga.addParam(.....);
ga.getXML(function() {
g_scratchpad.isFormValid = true;
g_form.submit(actionName);
});
return false;
}
Please mark it as solution proposed and helpful if it works for you.
Thanks,
Anand