URGENT!!! Save the form when the pop up closed by the user

sunilsafare
Mega Guru

Hi Experts,

I have a requirement where I am calling a UI page to perform some action on the form. First the user opens the form, modify the data and click on the ui action, there I am calling a ui page which displays a pop up to perform some action. If user close the pop up without performing the action by clicking the (X) button(the X button will be there for pop up window), then the data on the form should be saved automatically without clicking on the ui action again. I am stuck how to find the control that user has clicked on X button to perform save operation.

Thanks in advance!

Regards,

Sunil Safare.

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

I had this in one of the UI pages that I had designed. This will call some function when the close icon of the popup window is clicked. Add it on your UI page.



document.getElementById('popup_close_image').onclick = function() {submitForm();};


View solution in original post

12 REPLIES 12

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Sunil,



Try this


GlideDialogWindow.get().destroy();


Please check section 4.1 for more info.


http://wiki.servicenow.com/index.php?title=GlideDialogWindow_API_Reference#destroy.28.29


Kalaiarasan Pus
Giga Sage

I had this in one of the UI pages that I had designed. This will call some function when the close icon of the popup window is clicked. Add it on your UI page.



document.getElementById('popup_close_image').onclick = function() {submitForm();};


Thanks Pradeep



Thanks a lot Kalai. Worked Perfectly


One more help Kalai.



I have written submitForm() function as below.


function submitForm(){


GlideDialogWindow.prototype.get('ui_page_name').destroy();


gsftSubmit(null, g_form.getFormElement(), 'ui_action_name');


}



The code is entering here but still UI page pop up is not getting disappeared.



Thanks and Regards,


Sunil Safare