onSubmit client script submission should wait till the UI page selection/submission.

netp
Giga Contributor

Hello,

We have a onSubmit client script which calls a UI page(slushbucket) for selection of groups to be added in approvals.

The issue we are facing is, when user submits the form, the client script runs and the UI page is shown. But before user can select the groups and click OK, the form gets saved and group selection is not captured.

Already tried with return to FALSE, but in this scenario the modifications on the form will not be taken into consideration even the approvals records are added.

Here is the sample of the code.
var ans = confirm("Please confirm if you want to add additional approvers");
if(ans == false){
return false;
}else{
var dialog = new GlideDialogWindow('somename');
dialog.setTitle('Select additional approvals');
dialog.setSize(500,500);
dialog.render();
}

}

 

5 REPLIES 5

Aman Gurram
Giga Expert
I see the way you are rendering the Slush bucket is by loading a UI page in a Glide Dialogue Window. And once you render the Slush bucket, your onsubmit script doesnt wait and proceeds for submission. In this case, instead of making the OnSubmit script to wait until users selects the options on Slush bucket and Clicks the Okay button. You can render the Slush bucket by Using the same Code you posted (in the question) in a Client UI action. In the Okay button of the Slush bucket/GlideDialogueWindow, use g_form.submit() to submit the form. This way when the user clicks the Clinet Ui Action, say ‘Submit’ , the Sluch Bucket Pops up. After selecting Options from the sluch bucket when user clicks Okay, the form gets submitted. This way you are joining two different operations to achieve your result.