UI Page popup closes automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2017 09:00 AM
I need to show a custom popup when a record producer is submitted. I have created a UI Page and added code to an onSubmit catalog client script. The popup appears onSubmit as expected, however, it closes automatically and almost immediately. Is there code that I'm missing to make the UI Page wait for input before disappearing?
Catalog client script
function onSubmit() {
//show modal dialog
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new dialogClass("dialog_procurement_attachment_warning");
dialog.setTitle("Confirm: Validate Attachment Requirements");
dialog.setWidth(600);
dialog.render();
}
UI Page
<?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>
<div class="form-group">
<p>In order fully process your request, it must be accompanied by the following documents:</p>
<ul>
<li>Carl</li>
<li>Plow</li>
<li>Sponge</li>
<li>Additional requirements may include:</li>
<ul>
<li>BLAH</li>
<li>BLAH</li>
<li>and BLAH</li>
</ul>
</ul>
<p>If you have not attached these documents and can do so now, click <strong>Cancel</strong> and add your attachments. <br />
If you have already attached these documents, or will be attaching them at a late date, click <strong>OK</strong> to submit your request.
</p>
</div>
<footer class="modal-footer">
<button type="submit" class="btn " onclick="return submit();" name="submit" id="submit" >${gs.getMessage('OK')}</button>
<button type="submit" class="btn " onclick="return cancel();" name="cancel" id="cancel" >${gs.getMessage('Cancel')}</button>
</footer>
</g:ui_form>
</j:jelly>
Ui Page client script
function cancel() {
GlideDialogWindow.get().destroy();
return false;
}
function submit() {
GlideDialogWindow.get().destroy();
return true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2017 09:14 AM
Hi Chadlockwood,
But the dialog box is suppose to close when someone clicks on submit or cancel button. Is the code auto submitting?
Also what input you need to take in the UI page?
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2017 09:28 AM
Ankur,
Thanks for your response. Yes, the dialog is supposed to close when clicking on OK or Cancel, however, I'm not clicking either. I'm watching the popup appear and then disappear. OK/Cancel are the only "input".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 04:39 AM
Hi Chadlockwood,
Can you check if any other code is submitting the form?
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 07:13 AM
I don't believe I have code that is submitting the form but that may be part of the issue. My code is running in an onSubmit script; maybe it is not able to hold the form from being submitted. However, if I use a JavaScript confirm() popup, I can make the form wait. I'm not sure how I would replicate a confirm() with my UI Page.