UI Page popup closes automatically

chadlockwood
Kilo Sage

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;

}

12 REPLIES 12

Hi Chadlockwood,



which version you are using?


I think few Jakarta users have reported issue that there client script in ui page doesn't work fine.



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


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Yes, we're in Jakarta patch 1 hotfix 1


Hi Chadlockwood,



In my demo instance it is working fine in Helsinku. Unless and until I click ok or cancel form is not getting submitted as in your case as soon as you try it the form submits.



This seems issue with the instance and I think in jakarta future patch they might fix that or must have already fixed that.


Can you check with your team and raise Hi ticket to confirm this issue.



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


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Will do. Thanks


Hi chadlockwood,

I am also facing same issue. Did you get a solution for this issue?