Popup confirmation with multiple buttons
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2015 01:32 AM
I want to build an Alert once any incident gets resolved.
The popup needs to have confirmation buttons - 'Yes' , 'No' and 'Cancel' .
On click of 'Yes' or 'No' need to do actions on server side.
If i simply put an alert it shows only Ok and Cancel.
Has anyone implemented such confirmation box before?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 06:26 AM
Also a point to note, like i said before, if i set value to 7 instead, the popup autocloses updating the current opened incident
function clickedNo()
{
g_form.setValue('state',7);
gsftSubmit(gel('sysverb_update'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 06:29 AM
in your onsubmit script you are checking for the state value .. gsftSubmit submits the form and thus invoking the onsubmit script ..
This line
if (incidentState == 6){
Hence the dialog again pops up
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 06:34 AM
Okay that makes sense ! So how do i avoid that as i need to show this popup onSubmit itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 06:41 AM
add some condition to the if condition on the onsubmit script so that it is not invoked again ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 06:43 AM
Try making use of this function in your condition
http://wiki.servicenow.com/index.php?title=GlideForm_%28g_form%29#getActionName
Such that the onsubmit script gets executed only if the button is clicked initially and not everytime ... That will solve your problem...