Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

close child UX after submit & refresh parent

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • close child UX after submit & refresh parent

    I'm sure I'm overlooking something obvious, but stuck anyway...

    I have a simple UX that displays a record, a button on it opens up a child UX that is an essentially an edit dropdown window for some associated detail. Submit button on the child saves data back to a bound table via standard action scripting. Works fine. Now I just want the child UX to close itself after a successful submit, but just can't get it to close.

    In the "Save Submitted Data to Tables" action script there is a client-side event "After save succeeded Javascript" which seems like it would be the most appropriate place to simply use the .CloseContainerWindow(this) method to close the window. Problem is "this" no longer points to an element in the UX (like it usually does following a button click). I'm reluctant to write JS in the child UX that relies on the child having a specific ID, as I plan to call this child from multiple possible parent UXs, so don't want to have to explicitly name the child.

    I must be missing something obvious. How hard can it be to get a dialog box to just close! As a bonus, I'd like the child to tell the parent to refresh itself to reflect the change. Any help is greatly appreciated.

    Thanks & cheers!

  • #2
    Re: close child UX after submit & refresh parent

    How are you opening your child UX... what action are you using?

    Comment


    • #3
      Re: close child UX after submit & refresh parent

      Button click event on parent uses action javascript "Open a UX Component" to open child. Default alias is used.
      Thanks.

      Comment


      • #4
        Re: close child UX after submit & refresh parent

        if you look at the page that has the
        afterDialogValidate function and scroll down they discuss how to close the window where the dialog is hosted

        Code:
        var ele = $('mywindowid');
        	{dialog.object}.closeContainerWindow(ele);
        do you want to try that?

        ps:
        I noticed that you said something about not name the window name in child but the method discussed is from the calling dialog, is that ok with you?
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        [email protected]
        Skype:[email protected]
        1 914 924 5171

        Comment


        • #5
          Re: close child UX after submit & refresh parent

          As Govindan points out... the method for closing the child window is documented at the end of afterDialogValidate.

          '-------------------Closing the Window in Which the Dialog is Hosted -------------------------
          'In many cases the Dialog will have been opened in a pop-up Ajax window and you will want code in this event handler to close the pop-up window.
          'Here is how you can do this:
          'a) In the action that opens the Dialog in a window, set the Window title to something like this: MyWindowTtitle<span id="mywindowid"></span>
          'b) In this event handler set e.javascript to:
          ' var ele = $('mywindowid');
          ' {dialog.object}.closeContainerWindow(ele);

          'NOTE: If you have used Server-side Action Scripting in this event to save the submitted data to a table, then you might want to reference
          'the rtc.flagRecordWasSaved variable (which is set by the Action Script) to decide if the window should be closed or not. In addition, since the
          'Server-side Action will have already set the value of the e.javascript variable, you will want to append your code to e.javascript, as follows:
          'e.javascript = e.javascript + crlf() + var ele = $('mywindowid'); + crlf() + {dialog.object}.closeContainerWindow(ele);
          Using this method you need to check rtc.flagRecordWasSaved and follow the e.javacsript rules discussed.

          Using the event you mentioned, After save succeeded Javascript, you can just use

          'a) In the action that opens the Dialog in a window, set the Window title to something like this: MyWindowTtitle<span id="mywindowid"></span>
          'b) In this event handler set e.javascript to:
          ' var ele = $('mywindowid');
          ' {dialog.object}.closeContainerWindow(ele);
          And Alpha looks after everything for you. Code only gets run after the save has succeeded and this code is appeneded to e.javascript for you.

          Comment


          • #6
            Re: close child UX after submit &amp; refresh parent

            Thanks Govindan and David for your comments on this. I hadn't noticed the discussion of this at the end of afterDialogValidate. The problem I still see is that these solutions all rely on the parent explicitly setting the UX alias (or specifying a span tag) when calling the child. I'm concerned about a few things with this:

            1. Does this create conflicts if I have multiple instances of the parent open, thereby possibly having multiple child UXs with the same hard-coded UX alias or span tag?

            2. Hard-coding the name of anything into code in the child UX component when that name is not defined in the child UX concerns me. Things break if I re-use the child in another parent?

            I wish I could find a way to encapsulate this behavior exclusively in the child UX, and just let Alpha assign unique default aliases to however many child instances appear. A way that that I can have the child identify itself and close that doesn't rely on any explicit naming from the parent. Is there a way that anyone knows that this can be be solved?

            Many thanks.

            Comment


            • #7
              Re: close child UX after submit &amp; refresh parent

              Remember that the Window Title is completely variable. You can include {control} data in the name. You could include an Id in the Title and that makes every instance of that window available with a unique element id.

              Comment


              • #8
                Re: close child UX after submit &amp; refresh parent

                Originally posted by rvanderbes View Post
                Thanks Govindan and David for your comments on this. I hadn't noticed the discussion of this at the end of afterDialogValidate. The problem I still see is that these solutions all rely on the parent explicitly setting the UX alias (or specifying a span tag) when calling the child. I'm concerned about a few things with this:

                1. Does this create conflicts if I have multiple instances of the parent open, thereby possibly having multiple child UXs with the same hard-coded UX alias or span tag?

                2. Hard-coding the name of anything into code in the child UX component when that name is not defined in the child UX concerns me. Things break if I re-use the child in another parent?

                I wish I could find a way to encapsulate this behavior exclusively in the child UX, and just let Alpha assign unique default aliases to however many child instances appear. A way that that I can have the child identify itself and close that doesn't rely on any explicit naming from the parent. Is there a way that anyone knows that this can be be solved?

                Many thanks.
                this is my opinion.
                whenever a window is open regardless in the same computer or another computer elsewhere in the internet, if that window is active then any javascript will work only on that window since it is browser script. this will be true even when one opens multiple instances of the same parent opening child in the same computer. since the active window gets the keystrokes the active window will close. not the other windows.
                to test my theory I opened the same parent three times and called the child in each and did transaction in each of the dialogs and closed each dialog in a random fashion with no rhyme or reason. all child windows closed and the other windows stayed open. this is possible since the window is open as a modal popup.
                I think this is what alpha thought process to assign the name in the parent and linking that name in the child javascript actions.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                • #9
                  Re: close child UX after submit &amp; refresh parent

                  thanks for everyone's help and thoughts on this. Unfortunately, the more I try to understand this, the more lost I get.

                  In my testing, if I follow the directions in the afterdialogvalidate event, and insert a span tag into the child window title, I can then use that to close the child. I don't really understand how to put control info into this to make it unique, and pretty sure I'm going to break it. This just seems to be a very painful way to go about what should be a fairly common task?

                  In the Open UX Component action javascript that calls the child UX there is the option to specify the window name. The help associated with this field explains that this window name field should be used for this purpose, and gives examples of how to use this to get a pointer to the child UX. Although it seems straightforward, I just simply cannot get this to work.

                  In fact, I'm not really sure what the difference is between the window name, window ID, alias. I've read other posts related to this, and it seems like many have different strategies for getting handles & closing dialogs. Alpha seems to document the approach to this differently in a few places. Just can't figure out what's what? I've watched so many selwin videos, I now hear him in my sleep!

                  Any thoughts on this, or referrals to relevant documentation are much appreciated. Thanks!

                  Comment


                  • #10
                    Re: close child UX after submit &amp; refresh parent

                    ok
                    try this
                    in the child dialog you have a button to submit the dialog that calls the aftervalidae event to save the data right.
                    add one more action inline javascript
                    {dialog,object}.closeContainerWindow(this);
                    save and run the parent dialog see if it closes the child dialog.
                    the drawbacks are, this will fire even if the data is not saved, sometime this is unpredictable. it may not close. for most part it should close.
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    [email protected]
                    Skype:[email protected]
                    1 914 924 5171

                    Comment


                    • #11
                      Re: close child UX after submit &amp; refresh parent

                      Gandhi, thanks... you're correct, that will get the dialog to close, but since the method is not being called at the appropriate point in the cycle, there's more coding to be done to check the status of the save, etc. It will work, in this example, but I'm really looking for an understanding of how to reliably & predictably get pointers to popups/parents so methods can be executed on them in response to the appropriate events.
                      I don't know if the documentation is wrong, but it seems to contradict itself, of just not work reliably. I keep thinking I'm missing something obvious, because this seems to me like it would be such a common scenario?

                      Thanks!

                      Comment


                      • #12
                        Re: close child UX after submit &amp; refresh parent

                        SOLVED!

                        Thanks for the help on this. Just to close the loop, here's the solution I used --

                        Placed in the 'After Save Succeeded Javascript' of the 'Save Submitted Data to Tables' action script:

                        // close window
                        var ele = {dialog.Object}.getPointer('BUTTON_SUBMIT');
                        {dialog.Object}.closeContainerWindow(ele);

                        In the end, quite simple. Problem along the way, was after the callback fires, and the JS runs, 'this' is uninitialized, so needed to find another way to get a pointer to the window.

                        Comment

                        Working...
                        X