- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2018 08:01 AM
We have a requirement to add a pop-up confirmation message when saving a change task to complete. We are not using an UI Action button for the close task but instead saving from the state field choice list. I was able to accomplish the alert pop-up through a client script but I need them to be able to select 'Yes' or 'No'. If no is selected, then the change task will not save. Thanks in advance for your assistance.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2018 08:57 AM
Thank you all. I was also able to accomplish my desired results with this onSubmit client script.
function onSubmit() {
var state = g_form.getValue('state');
if((state == 3) || (state == 4) || (state == 7)){
return confirm('Are you sure you want to close this task?');
}
if(state == 6){
return confirm('Are you sure you want to cancel this task?');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2018 08:10 AM
create one onSubmit client script:
var val = g_form.getValue("state");
if (val== '4') // verify state value for close.
{
var answer=confirm("Are you sure you want to Close the task?");
return answer;
}
Thanks,
Ali
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2018 08:16 AM
Hi heathers,
A bit more complex than browser prompts, but here's a GlideModal dialog I've used for a client-side UI action that should work in a client script with minor adjustment:
// *** F U N C T I O N showConfirmDialog ( ) *********************
//
// Yes / No prompt to comfirm before primary function
//
function showConfirmDialog() {
var subCallback = function() {
submitItAlready();
};
// set up the dialog
var dialogContent = 'Are you ready to send this request to the client?';
var subDialogClass = typeof GlideModal != 'undefined' ? GlideModal : GlideDialogWindow;
var subDialog = new subDialogClass('glide_confirm_standard');
subDialog.setTitle('Submit for approval');
subDialog.setPreference('warning', true);
subDialog.setPreference('title', dialogContent);
subDialog.setPreference('onPromptComplete', subCallback.bind(this));
subDialog.render();
}
// *** F U N C T I O N submitItAlready ( ) *********************
//
// Callback for the confirmation dialog
//
function submitItAlready() {
// submit the form
gsftSubmit(null, g_form.getFormElement(), 'submit_approval');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2019 06:52 AM
Hi Mike,
Very nice alert message. So different than the normal browser prompt. I am trying to use your code in a OnSubmit client script however the alert message pops up briefly but disappears.
How can I get this alert message to stick until the user clicks either button?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2018 08:57 AM
Thank you all. I was also able to accomplish my desired results with this onSubmit client script.
function onSubmit() {
var state = g_form.getValue('state');
if((state == 3) || (state == 4) || (state == 7)){
return confirm('Are you sure you want to close this task?');
}
if(state == 6){
return confirm('Are you sure you want to cancel this task?');
}
}