gsftSubmit wait for dialog to close

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 04:36 PM
All,
I have a dialog window that renders successfully. I need to, wait till the user enters some data and submits the dialog window, then update the form. When I try the gsftSubmit(), the dialog render, the script keeps running, and the record is not updated after the dialog box is submitted. I have also entertained using an onSubmit() client script. Again the dialog is rendered but promptly closes with out allowing any data to be entered when the script gets to the g_form.submit() function. Any help is greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 04:47 PM
Hi,
You can wait for the dialog window to close before it execute the gsftSubmit().
The better way to achieve this is to write your logic in the UI Page which is used to open the dialog window based on the user action.
You can write the client script or server side script in the "processing script" of UI page.
You can look at the example for the same here: UI Page
Thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2018 06:03 AM
Rahul,
The end goal would be something like this.
- Interact with form / enter or change information on the form
- Click UI action such as Save and Close
- Render dialog
- Input data to daialog window
- When the dialog is closed the form is submitted from the client and commits the changes to the server
I need the record to update on the client to grab any new data and comit to the server. The dialog is used to capture information for a custom time tracking application, I am gathering information form the current record to populate fields on it. It seems the Processing Script can populate data back to the record on the server and update it there, which is why I was hoping to use gsftSubmit. Can you think of anything else that may work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 08:03 AM
I realize this is an older post, but in case someone comes across this and is trying to find a way to use a GlideModal in an onSubmit client script and you're running into issues where it's either looping or submitting the record before the user has a chance to confirm/validate etc on the modal window, try this:
if(g_scratchpad._action_confirmed) {
return true;
}
var dialog = new GlideModal('glide_modal_confirm', false, 300);
dialog.setTitle(new GwtMessage().getMessage('Confirmation'));
dialog.setPreference('body', new GwtMessage().format("Are you sure to save?"));
dialog.setPreference('focusTrap', true);
dialog.setPreference('onPromptComplete', doComplete);
dialog.setPreference('onPromptCancel', doCancel);
dialog.render();
return false;
function doComplete() {
g_scratchpad._action_confirmed = true;
gsftSubmit(null, g_form.getFormElement(), g_form.getActionName());
}
function doCancel() {
}
Full credit to icerge on GitHub who came up with this one. I spun around with different ways to try to use gsftSubmit to get this to work.
Using modal windows in SN: GlideModal, confirm onSubmit · GitHub