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 04:10 AM
Tried this now,
If i call the glidedialog destroy method earlier, and then set the value, update
On click of the No button, it again reloads the same popup.
Earlier it was not reloading but shifting aside on click.That's the only difference in the behaviour..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 04:12 AM
How are you loading the dialog in the first place ? onload function ? onload will execute after you have updated the value and submitted the form ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 04:21 AM
Glidedialog window is defined for the onsubmit client script.
Here's my client script code
===
function onSubmit() {
var incidentState = g_form.getValue('state');
var incidentNum = g_form.getValue('number');
if (incidentState == 6){
var ga = new GlideAjax('CloseChildUtils');
ga.addParam('sysparm_name','checkChildexists');
ga.addParam('sysparm_parentNumber', incidentNum);
ga.getXMLWait();
var childCount = ga.getAnswer();
if (childCount != '0')
{
showConfirmationDialog();
return false;
}
}
function showConfirmationDialog() {
var dialog = new GlideDialogWindow('closechild');
dialog.setTitle('Confirmation required');
dialog.setSize(550,300);
dialog.render();
}
}
====
I have seen some behaviour changes in the 'return ' value after the showConfirmationDialog(); is called from the client script.
If i comment the return, the popup shoes up and quickly goes away reloading the form. So for keeping the glidedialog open, mentioned as return false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 06:10 AM
Can you share the code for ui page as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 06:20 AM
Sure.
UI Page
===
HTML Section
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<table style="height:50px">
<tr style="width:100px;"><b>Resolve child?</b></tr>
<tr>
<td >
<input type="button" onclick="clickedYes()" value="Yes"/>
</td>
<td >
<input type="button" onclick="clickedNo()" value="No"/>
</td>
<td>
<input type="button" onclick="cancel()" value="Cancel"/>
</td>
</tr>
</table>
</j:jelly>
---------------------------
Client script in ui page (Providing only for onclick of No button)
function clickedNo()
{
//GlideDialogWindow.get().destroy();
g_form.setValue('state',6);
gsftSubmit(gel('sysverb_update'));
}
---------------------
No processing script