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

Bhargava4
Mega Expert

Hello Mates,

I am also facing same issue. Do you guys having any update on this.

Please post the solution its very help full to me .

 

Ram

Ram,

Unfortunately, I was unable to find a more elegant solution. I ended up using a confirm() in an onSubmit client script:

function onSubmit() {
		
	var msg = "In order to fully process your request, it must be accompanied by the following documents:\n\n";
	msg += "\t- Enrollment Form\n";
	msg += "\t- Corporate NDA\n";
	msg += "\t- Certificate\n";
	msg += "\t- Additional required supporting documents may include:\n";
	msg += "\t\t- Terms agreement\n";
	msg += "\t\t- Statement of work\n";
	msg += "\t\t- End User License Agreement\n";
	msg += "\t\t- Order form, etc.\n";
	msg += "\nFailure to attach any required documents may delay processing of your request.\n";
	msg += "\nIf you have not attached these documents and can do so now, click Cancel and add your attachments.\n";
	msg += "\nIf you have already attached these documents, or will be attaching them at a later date, click OK to submit your request.";

	var con = confirm(msg);
	return con;
}

I hope this helps.

Shiraz2
Mega Guru

I had the same issue where my UI POP pages was not staying put on the page. I found out that in my client script I was missing a:

 

return false; 

 

after rendering the GlideDialogWindow. in Chadlockwood code it should be:

 

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();

return false;

}

 

See if this helps.