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

popup warning window before closing grid or dialog that is_dirty.

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

    popup warning window before closing grid or dialog that is_dirty.

    I am looking for a way to make sure users don't accidentally close a window that they have done edits to.

    The idea is if somebody hit the X in the top right hand corner of a window I would like to do some stuff before that window closes.

    Specifically I would like to check is_dirty and if TRUE then I would like a warning window to pop up saying: "You have un-saved changes in this component. Are you sure you would like to leave without saving first? [Exit Disregarding Changes] [Do Not Exit]"

    I have both Grid's and Dialog's which I would like to do this with. Can anybody point me in the right direction?

    #2
    Re: popup warning window before closing grid or dialog that is_dirty.

    This might help

    http://msgboard.alphasoftware.com/al...hlight=isdirty

    or this

    http://msgboard.alphasoftware.com/al...hlight=isdirty

    Comment


      #3
      Re: popup warning window before closing grid or dialog that is_dirty.

      Have some answers which I pieced together from a bunch of sources plus my own trial and error. Hope this helps somebody else.

      Anyways, first thing is to understand is that there are two things you have to do for each window you want to check for dirty records before closing. First is to put some code in the on-click event that opens the window, second is to put an update-able variable in the actual grid/dialog you are working with which updates it's isDirty state.

      Step 1) - Add Code to OnClick event of the button that opens the window you want to check for dirty records in.

      - Go to Button "OnClick" event.
      - Edit the action that opens the Grid or Dialog
      - Go to the "Window Javascript Events" section at the very bottom.
      - Click on the "onBeforeHide" section.
      - Add the following code:

      if (typeof window.top.windowIsDirty == 'undefined') return true;
      if (window.top.windowIsDirty) {
      A5.msgBox.show('WARNING','Changes were made. You must Save or Cancel edits to exit.','O');
      return false;
      } else {
      return true;
      }



      Step 2) - Add code in the actual Grid or Dialog you want to check for dirty records in.

      You will need to add this line into the Client Side Events section:

      window.top.windowIsDirty = e.isDirty;


      For a Dialog go to:
      Events - Client Side - onStateChange

      For a normal Grid with no detail view go to:
      Code - Client Side Events - onGridStateChange

      For a Grid with a Detail View
      Code - Client Side Events - onDetailViewStateChange




      Step 3) Additional Tweaks Needed if you have multiple over laping Windows.
      - eg. You have a customer list grid that has a button that opens a customer detail grid that has a button on it that opens a customer orders dialog. Where you want to check if the order page has changes before closing and then want to check the customer detail page for changes before closing.

      To do this you can not use the same variable: window.top.windowIsDirty for both pages otherwise the system doesn't know the difference between the two and weird things will start to happen. Instead create window.top.customerWindowIsDirty and window.top.orderWindowIsDirty variables.

      In fact, it's probably good programming practice to create a new variable for every page you work with to avoid any confusion.

      Comment


        #4
        Re: popup warning window before closing grid or dialog that is_dirty.

        Thanks Jason,

        This has helped me solve the same frustrating issue.

        By the way, have you ever had to solve the "_newDVValues" javascript error you get when you popup a new detail record and then click on a lookup field before the new record has been dirtied? I am wondering what is the best way to work around this error as it is driving me nuts.

        Andy.

        Comment


          #5
          Re: popup warning window before closing grid or dialog that is_dirty.

          Probably something like

          if ('_newDVValues' == 'Undefined')

          Comment


            #6
            Re: popup warning window before closing grid or dialog that is_dirty.

            David,
            Have you ever seen the error I'm talking about?
            Open a new record (mine is a single, new detailed grid record in a popup window) and click on a typical user-defined lookup field first before any other. Date pickers don't give the error, but most other user lookups do. Ideally, I would love a proper solution from Alpha.
            Andy.

            Comment


              #7
              Re: popup warning window before closing grid or dialog that is_dirty.

              Actually, a simple clientside ".setValue" works once you change the value of any field. So, not to worry.
              For example:
              {grid.object}.setValue('D','JOURNALTYPEID',1);
              ANdy.

              Comment


                #8
                Re: popup warning window before closing grid or dialog that is_dirty.

                No, I haven't seen this one. DBF? SQL? Does it matter? For lookup... do you mean a dropdown?

                Comment


                  #9
                  Re: popup warning window before closing grid or dialog that is_dirty.

                  SQL, but not sure this matters.

                  AN EXAMPLE: If you have a grid showing a list of all your customers, and you have a button (or link) in each row that opens a totally different grid component which is set up for the sole purpose of editing that particular customer detail record, then you might see this. The customer detail component is set up as a detail view only (grid view blanked out with display:none) and allowed to show only 1 record at a time, no navigation, new record only when grid query is empty, etc.

                  Everything works exceptionally well and as expected, except when the following occurs: (1) try to add a new record AND (2) the first field you try to enter information into is a (component-based) lookup select field (e.g. a lookup that opens a grid component that allows you to select the Organization that the customer belongs to and populate the OrgID and OrgName fields).

                  The issue is that if the detail view component is NOT DIRTY, then a "_newDVValues" javascript error is thrown. Once dirty, there is no error. This issue has been around for a year or so, to my knowledge.

                  So, the workaround is to change the value of a field after object initialization so the detail record becomes dirty: {grid.object}.setValue('D','CONTACTTYPEID',1);

                  Maybe I should report it as a bug.

                  Andy

                  Comment


                    #10
                    Re: popup warning window before closing grid or dialog that is_dirty.

                    Great news! I got the pre release 2745-3949 and discovered that there is now a property to check on the Open A Grid Component (OR dialog component). It is 'Warn Before Closing If Grid In Window is Dirty' and it is working beautifully!
                    Carol King
                    Developer of Custom Homebuilders' Solutions (CHS)
                    http://www.CHSBuilderSoftware.com

                    Comment


                      #11
                      Re: popup warning window before closing grid or dialog that is_dirty.

                      Yes, this property is very useful.
                      BTW - Selwyn also provided a fix for my earlier reported error.

                      Comment


                        #12
                        Re: popup warning window before closing grid or dialog that is_dirty.

                        Originally posted by kingcarol View Post
                        Great news! I got the pre release 2745-3949 and discovered that there is now a property to check on the Open A Grid Component (OR dialog component). It is 'Warn Before Closing If Grid In Window is Dirty' and it is working beautifully!
                        Carol,

                        I was wildly intrigued by your reply on this matter but can not find the solution to which you refer. My builds are later
                        than the ones you listed so the property should be there.

                        Can you please provide a couple of screen snapshots to help point me to your solution? At this point I don't know
                        where (AT ALL) you are starting from to access this property. General terms are not helping.

                        Like a lot of things in A5, the answer is obvious "ONCE" your learn it but you can spend hours or days trying to find
                        something that might be right in front of your face. That's where I am right now. Please help!

                        Comment


                          #13
                          Re: popup warning window before closing grid or dialog that is_dirty.

                          Here you go, Tom. http://screencast.com/t/yTwg2ANn (same thing is on the open a dialog genie)
                          Carol King
                          Developer of Custom Homebuilders' Solutions (CHS)
                          http://www.CHSBuilderSoftware.com

                          Comment


                            #14
                            Re: popup warning window before closing grid or dialog that is_dirty.

                            Originally posted by kingcarol View Post
                            Here you go, Tom. http://screencast.com/t/yTwg2ANn (same thing is on the open a dialog genie)
                            Carol,

                            With your help I was able to locate that specific property. Unfortunately it was already checked and wouldn't prove
                            to be a solution to my immediate problem.

                            In short, what I am trying to do is prevent my user from leaving a Detail Part screen before they have either saved changes
                            or at least canceled changes. The detail part is part of a major tabbed UI interface which has other buttons etc. loaded
                            on it. Those other buttons (or even other tabs) could prove problematic if the user is not forced to save first.

                            I would like to disable ALL OTHER controls if possible. Making the Save or Cancel options the only available options.

                            This is a web app and the disable methods don't work for me at all unless I am doing it wrong. Thought maybe
                            you have run across this same scenario.

                            Comment

                            Working...
                            X