g_form.save, g_form.submit and gsft method I am saving form but the form is loading again and again

Komaldeep
Tera Contributor

Hello Everyone,
I want to thank you all in advance.
I am facing issue while using g_form.save(), g_form.submit(); and  gsftSubmit(null, g_form.getFormElement(), 'sysverb_update_and_stay'); method
The requirement is to save the record coming from the script include everything is working fine but when I am trying to save my record in the onchange client script with the above method the form is getting loaded again and again for me.
Here is the code I wrote -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}

var ga_project = new GlideAjax('sn_hr_core.ProjectDetailsPosition');
ga_project.addParam("sysparm_name", "get_ProjectName");
ga_project.addParam('sysparm_usr', g_form.getValue('u_project_number'));
ga_project.getXML(getCal);


function getCal(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");

g_form.setValue('u_project_name', answer);
g_form.save();
}
}

12 REPLIES 12

Hello @Swapnil Shirsik 
It works with that, but my requirement is to save the record without clicking on any button that why I used g_form.save();

Did you try with return true; instead of g_form.save();

Yes I tried it's not working