Alpha Video Training
Results 1 to 13 of 13

Thread: How to Close Modal UX Unbound Popup Window?

  1. #1
    Member
    Real Name
    Mark Moss
    Join Date
    Aug 2015
    Posts
    38

    Post How to Close Modal UX Unbound Popup Window?

    HELP,


    Does any know how to "Close a Modal UX Unbound Popup Window" and where to put the code in the UX component ( ie. clientside - afterResetForm )?


    Mark


  2. #2
    "Certified" Alphaholic
    Real Name
    Lee Vasic
    Join Date
    May 2010
    Location
    Salt Lake City
    Posts
    1,215

    Default Re: How to Close Modal UX Unbound Popup Window?

    Depending on how you are calling it. There is a flag that you can set. "Window title has close button".

  3. #3
    Member
    Real Name
    Mark Moss
    Join Date
    Aug 2015
    Posts
    38

    Default Re: How to Close Modal UX Unbound Popup Window?

    Ivasic,


    Thank you so much for your reply, and yes that button option is checked and yes there is an 'X' in the upper right of the Title.

    But what I want to do is close the Popup Window after the person presses the submit button that I have on the Popup.

    This is a UX Unbound Popup Window invoked from a Javascript Action using the Open a UX Component where the Window-Type is set to Modal-Popup.

    I pass data from the invoking UX by way of Arguments, which are used to set the value of the Textboxes, and when the user is finished changing those fields they are used to update the two or three MSSQL Database Tables when they press the Submit ( Xbasic code is used to do the updates ). After the updates are complete an Email is sent out with a notification message.

    After this is all done, I want to close the Popup Window, but all of the code that is out there does not work, or I have not been able to make it work.


    Mark

  4. #4
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,869

    Default Re: How to Close Modal UX Unbound Popup Window?

    Try this after your data saving code...

    Code:
    {dialog.object}.closeContainerWindow(this);
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

  5. #5
    Member
    Real Name
    Mark Moss
    Join Date
    Aug 2015
    Posts
    38

    Default Re: How to Close Modal UX Unbound Popup Window?

    mikeallenbrown,



    Thank you so much for responding, but alas it did no work.

    I have attached a small example of two UX'es - OpenPopupWindow and ClosePopupWindow, please try them out and maybe you can figure out a solution.


    Mark
    Attached Files Attached Files

  6. #6
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,869

    Default Re: How to Close Modal UX Unbound Popup Window?

    In your closePopupWindow component button number 2 (with my code suggestion) works.
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

  7. #7
    Member
    Real Name
    Mark Moss
    Join Date
    Aug 2015
    Posts
    38

    Default Re: How to Close Modal UX Unbound Popup Window?

    mikeallenbrown,


    Not on my machine, what browser are you using?



    Mark

  8. #8
    Member
    Real Name
    Mark Moss
    Join Date
    Aug 2015
    Posts
    38

    Default Re: How to Close Modal UX Unbound Popup Window?

    Wait,


    The Demo does work with your code, however it does not work with mine.

    Here is the way the Submit button is set up on my UX Component

    JavaScript
    Click
    Action Javascript

    1. Ajax Callback - calls Xbasic routine to update MS SQL Database Table A
    2. Ajax Callback - calls Xbasic routine to update MS SQL Database Table B
    3. Send email
    4. Inline-JavaScript - {dialog.object}.resetForm(false);
    5. Inline-JavaScript - {dialog.object}.closeContainerWindow(this);


    Is there a way to place a wait action to delay the processing of the closeContainerWindow(this), from happening to quickly?


    Mark

  9. #9
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,869

    Default Re: How to Close Modal UX Unbound Popup Window?

    Shouldn't matter what browser is being used.

    There is a lot going on with your code there. First, why do you need to reset the form before closing the window? That isn't necessary, is it? It's going to be closed. Second I'd execute #1 callback first. When it's complete execute #2. When that's complete execute your send email routine (in my code example below I presume you're using a javascript action for this). When that's complete then close the window (you can use the JS actionscript 'After message sent' event that the Send email message offers).

    Code:
    function updateOne as c (e as p)
    
    	'execute your code here
    	
    	updateOne = "{dialog.object}.ajaxCallback('','','updateTwo','','',{chunkedResponses: {allow: false},deviceOfflineFunction: function() {   }});"	
    
    end function
    
    
    function updateTwo as c (e as p)
    
    	'execute your code here
    	
    	updateTwo = "{dialog.object}.runAction('SEND_EMAIL');"
    	
    end function
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

  10. #10
    Member
    Real Name
    Mark Moss
    Join Date
    Aug 2015
    Posts
    38

    Default Re: How to Close Modal UX Unbound Popup Window?

    mikeallenbrown,


    So let me get this straight,

    1. In the Action Javascript have One "Ajax Callback" which calls Xbasic routine to update MS SQL Database Table A
    2. Modify the Xbasic Code in #1 and add the "" updateOne = "{dialog.object}.ajaxCallback('','','updateTwo','','',{chunkedResponses: {allow: false},deviceOfflineFunction: function() { }});" "" which will run the Second Xbasic routine.
    3. Modifiy the Second Xbasic routine to add the running of the Send Email routine and finally add the " {dialog.object}.closeContainerWindow(this); " to the After Message Event of the Send Email routine.


    Then copying the Javascript Action "SendEmail", "View JavaScript", "Xbasic Callback Function" as below and this is what would be called by the After Message Event?


    If this is what you meant, I think I understand on how it flows, could you tell me why this will work, or better yet why the other way failed?


    Mark


    function SEND_EMAIL as p ()
    dim v as p
    with v
    DIM part as C = "Dialog2"
    DIM sendMethod as C = "Internal"
    DIM mandrillKey as C
    DIM sparkPostKey as C
    DIM useDefaultSettings as L = .T.
    DIM smtp_server as C
    DIM smtp_username as C
    DIM smtp_password as C
    DIM smtp_port as C
    DIM smtp_SSLOption as C
    DIM from as C = "support@xxxxxxxxx.com"
    DIM from_alias as C = "support"
    DIM messageSubject as C = "{Store_Name}Service Request"
    DIM sendTo as C = "{EMail};{Technician_Email};"
    DIM cc as C
    DIM bcc as C = "XXXXXXXXXXXXXXXXXXXX"
    DIM loadMessageFromRepository as L
    DIM howToSpecifyRespositoryName as C = "SpecifyNow"
    DIM messageNameInRepository as C
    DIM howToSpecifyMessage as C = "SpecifyNow"
    DIM messageBodyHTML as C = <<%str%
    <img src="https://XXXXXXXXXXXXXXX.png" style="width:px;height:px"><br><br>
    {Store_Name} - <b>{Store_ID}</b><br>
    {Store_Address1}<br>
    {Store_City}, {Store_State} {Store_ZIP}<br>
    <br>
    {Store_Contact_Name}<br>
    {Store_Contact_Title}<br>
    <br>
    {Phone}<br>
    <br>
    This Email is to inform you that your Service Technician: {Technician_Name}<br>
    will be at your Store to work on your Ice Machine on: {Technician_ScheduledOnsite}.<br>
    <br>
    Servive Request Case Number: {Case_Number}<br>
    <br>
    Issue: {Case_Issue_Type}<br>
    <br>
    <br>
    Details: {Description}<br>%str%
    DIM messageBodyText as C
    DIM attachments as C
    DIM storeMessageInOutbox as L
    DIM clientSideEvent as P
    DIM clientSideEvent.afterMessageSent as C = "SendEmail_Alert"
    DIM showConfirmationMessage as L = .T.
    DIM confirmationMessageSuccess as C = "Message was sent."
    DIM confirmationMessageFailure as C = "Message was not sent because of an error."
    DIM useDotNetLibrary as L
    DIM sendWhen as C = "Immediate"
    DIM WorkQueueFormat as C = "XbasicScript"

    end with
    SEND_EMAIL=v
    end function

  11. #11
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,869

    Default Re: How to Close Modal UX Unbound Popup Window?

    Quote Originally Posted by markemoss View Post

    why the other way failed?

    SEND_EMAIL=v
    Maybe this is the culprit. You're emitting 'v' back to the browser in your send email function. That seems like a typo to me. If you comment out the SEND_EMAIL=v part in your original code does the original code then work? I'm guessing the SEND_EMAIL=v caused a javascript error preventing the rest of the code from running.
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

  12. #12
    Member
    Real Name
    Mark Moss
    Join Date
    Aug 2015
    Posts
    38

    Default Re: How to Close Modal UX Unbound Popup Window?

    mikeallenbrown,


    I did not create the function Send_Email, I went into the button Javascript click event selected Action Javascript and then select the Action of 'Send email' and filled in the required fields.

    If you select the SendEmail action and then click on the View Javascript and then select the Xbasic CallBack Function Tab, you will see the code that it generate's.

    Please take a look at the two screen shots.


    Mark
    Attached Images Attached Images

  13. #13
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,298

    Default Re: How to Close Modal UX Unbound Popup Window?

    the code in your test case is wrong.


    the first button is not going to work because you have a button in the child component, but the window is part of the parent component.
    in other words, the window you are trying to close is part of the parent component, but the button you are trying to define is part of the child component.
    so your code to get the pointer to the window fails.

    furthermore - while you did give the window an explicit name in the action that opens the child window You did NOT use this name in your code which tried to close the window.



    you would need to convert your action javascript to text mode so that you can edit it and then change it to this:







    Code:
    var name = 'MYWINDOW'
    var po = {dialog.object}.getParentObject() //get a pointer to the parent component
    if(po) {
         var win = po.getWindow(name); //get a pointer to the window -- the window is a member of the parent component
         if(win) win.hide();
    }




    Your second button is also wrong:


    You have

    Code:
    {dialog.object}.closeContainerWindow(this);

    Not sure what you meant by the 'this' in the command, but 'this' would be a reference to the button that you have the code on. So that can't work.
    Furthermore, you are calling a method to close a container window.

    The window you are trying to close is not a container window. Container windows are windows that are created by using the 'Window' container control.

Similar Threads

  1. Close multiple Modal-Popup Target windows
    By Ronald Anusiewicz in forum Mobile & Browser Applications
    Replies: 3
    Last Post: 04-25-2016, 02:37 PM
  2. Close modal-popup grid
    By Peter.Greulich in forum Application Server Version 10 - Web/Browser Applications
    Replies: 23
    Last Post: 01-28-2013, 10:48 AM
  3. Modal Window Popup Position Problem
    By Lesjml in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 01-07-2013, 09:34 PM
  4. Close Modal Popup
    By JLateralus in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 07-15-2011, 04:01 PM
  5. Lookup on Modal Popup Window Bug or by Design???
    By cavj1 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 8
    Last Post: 11-09-2009, 01:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •