UI Page from client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2016 07:03 AM
Hi all,
I have a requirement which is to display a message upon saving an incident. That sounds easy, only that I would like to have the message in a UI Page. This is what I have:
- Save button which has client switched off
- A client script which displays the UI Page set to trigger itself onSubmit
Problem is that the save button, when clicked, will sort of continue executing and the UI page is displayed briefly and automatically removed. I need the UI Page to remain on screen and users selects OK or Cancel.
I tried using confirmation dialogue and it works, however the UI Page does not (because it is another page itself).
Is there a way in this case to have the UI Page function as a confirm dialogue?
PS. I already created another button which basically functions as the Save button but set to run on Client. However I would like to retain the current Save button.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2016 07:59 AM
When I read through your post it seems like you want to have the save button function with a confirmation before saving and to retain the global save button itself to do this.
While I disagree with the path you're taking, you can modify the default Save button logic to look for the appropriate form you are on and execute your logic. So your UI page will contain the logic to determine what page it is on and then call the UI page like this:
var gdw = new GlideDialogWindow("nessus_mark_as_reviewed"); | |
gdw.setTitle("Nessus Items - Mark as Reviewed"); | |
gdw.setPreference("selected_items", selecteditems); | |
gdw.render(); |
Your UI page will look something like this:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:ui_form>
<!-- Get the checked items that were passed in -->
<g:evaluate var="jvar_checked_items" expression="RP.getWindowProperties().get('selected_items')" />
<table>
<tr><td>
Notes:
<!-- Create a text box for input that will go into the Notes field for all -->
<textarea rows="4" cols="50" name="review_notes" id="notes"></textarea>
</td></tr>
<tr><td>
Press OK to update all the records or press Cancel to return without updating anything.
</td></tr>
<tr><td>
<g:dialog_buttons_ok_cancel ok="return true" ok_id="ok_button" cancel_type="button" />
</td></tr>
</table>
<input id="checked_items" name="checked_items" type="hidden" value="${jvar_checked_items}" />
</g:ui_form>
</j:jelly>
And you will put the logic in the processing and client script sections you want (to redirect and to process).
If this all makes sense, let me know where you are getting hung up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2016 08:11 AM
Hi Trevor,
Thanks for your reply.
The default Save button is not set to run at Client - the UI Page would not be displayed, right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2016 08:37 AM
I completely missed that part of your post - my apologies. You are correct!