UI Pop dialog box for rejections comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2017 06:25 AM
Hi,
I'm working on a UI dialog box that pops up when rejecting an approval, but I have 2 issues which I need assistance on
Issue 1: the pop-up box is on the right hand side and I want to make it central and wider.
Issue 2: I need assistance on updating the current approval form state once clicking OK on the pop up
UI Action and page scripts below:
UI Action:
Onclick: commentsDialog()
script:
function commentsDialog() {
var dialog = new GlideDialogWindow("rejection_comments");
dialog.setTitle("Add Rejection Comments");
dialog.render();
}
UI Page:
HTML:
<g:ui_form>
<!-- Set up form fields and labels -->
<table width="100%">
<tr id="description_row" valign="top" align="center">
<td colspan="2">
</td>
</tr>
<tr>
<td>
<input type="hidden" name="my_sys_id" id="my_sys_id" value="${RP.getWindowProperties().get('sys_id')}"/>
<g:ui_multiline_input_field name="dialog_comments" id="dialog_comments" label=""
value="${jvar_comments_text}" mandatory="true"/>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr id="dialog_buttons">
<td colspan="2" align="right">
<!-- Add OK/Cancel buttons. Clicking OK calls the validateComments script -->
<g:dialog_buttons_ok_cancel ok="return validateComments()" ok_type="button" cancel_type="button" />
</td>
</tr>
</table>
UI Page Client script:
function validateComments() {
//This script is called when the user clicks "OK" in the dialog window
//Make sure there are comments to submit
var comments = gel("dialog_comments").value;
comments = trim(comments);
if (comments == "") {
//If comments are empty, alert the user and stop submission
alert("Please enter your rejection comments before submitting.");
return false;
}
//If there are comments, close the dialog window and submit them
GlideDialogWindow.get().destroy(); //Close the dialog window
g_form.setValue('comments', comments); //Set the "Comments" field with comments in the dialog
g_form.setValue('state','rejected');
}
Thanks,
Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:43 AM
Did you ever get this working? You seemed so close. I'm about to undertake a similar task. Was hoping to not reinvent the proverbial wheel.