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

How to Refresh Specific Fields on a Dialog after Closing a Dialog

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

    How to Refresh Specific Fields on a Dialog after Closing a Dialog

    I have a dialog (dialog2) that I am opening from a dialog (dialog1). Dialog2 is not being opened to edit data from dialog1. However when the data from dialog2 is saved it does use xBasic to update the data that is displayed on dialog1. There are four fields on dialog1 that I would like to "refresh" once dialog2 is closed. How do I do this?

    Thank you,
    CPGood

    #2
    Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

    You could set the properties to refresh on reload I think
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

    Comment


      #3
      Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

      Hi, Thank you for your reply. I looked for that straight away and I have found no options to do this on the setup form that you use to specify the dialog that you want to open. I have this dialog opening via a button on a dialog form.

      CPGood

      Comment


        #4
        Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

        I am understanding you correctly the "New" info should update the dialog after you add an entry o new record to the other dialog, right?
        If that's the case...
        I have this working in one of my dialogs and can post this after I look back into how I did it. Unfortunately I am dealing with my own issue right this second where Alpha takes a day (literally hours) to convert a calculated field iif expression into java-script!
        As soon as I find how I did it I will report back to you, although I think it was a problem that was fixed in the latest build of V12 or something that was added that made it very simple, I really can't recall.
        Anyways - if that's what your looking for I think I can help you solve it.
        NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

        Comment


          #5
          Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

          Hi, yes that is what I want to have happen. I would like for the updated data that has been written to the underlying record that dialog1 is based on to be refreshed. It seems that essentially what I want to do is for the data displayed on dialog1 to be refreshed once dialog2 is closed. Dialog2's after validate event has already written updated values to the record that dialog1 is displaying. I just need to force dialog1 to refresh itself and display this updated data.

          CPGood

          Comment


            #6
            Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

            If you can get the correct record ID back to dialog1, you could use the .populateControlsFromTable() method.

            In dialog2, afterDialogValidate event, pass the record id to a javascript window variable like this:
            e.javascript = "window['recid'] = " + recid + ";"
            recid needs to be a local variable that contains the record id of the updated record.

            Then, in your action (if you are using action Javascript) that opens dialog2, in the Window Javascript Events onHide event, do something like this:

            var recid = window['recid'];
            if (typeof recid != 'undefined') {
            {dialog.Object}.populateControlsFromTable(recid);
            delete window['recid'];
            }

            If you have data binding set up, it should refresh. If dialog1 is "dirty", then you might need to call the .resetForm(false); method right before the popluate method.
            - Dan Hooley
            - Custom Desktop or Web database development -

            Comment


              #7
              Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

              Hi Dan,

              Thank you for your reply. I'm trying to get this to work but I'm still having problems. I can't figure out how to get the recid loaded. Before I open dialog2 I already know the unique id of the record that is displayed in dialog1. After dialog2 is closed I simply want to repopulate dialog1 using the same unique id that originally populated dialog1. I just need the field values refreshed because I have used xbasic in the after validate event of dialog2 to update the record that is being displayed. I have the unique id in a session variable. Since I know this session variable can I use it in the populatecontrolsfromtable command?

              Here is my code on the AfterDialogValidate event:

              Code:
              'To edit this action, place insertion point anywhere in the command, then click the 'Action Scripting' button'.
              ExecuteServerSideAction("Save Data::SaveCheckoutData")
              
              if rtc.flagRecordWasSaved=.t. then
              	
              	DIM v_Checkout_ID AS N
              	DIM v_Instrument_ID AS N
              	
              	v_checkout_id = rtc.a_sections[1].rows[1].alias[1].primaryKeyValue[1].value
              	v_Instrument_ID = SESSION.INSTRUMENT_ID
              	
              	instrument_tbl=table.open("instruments")
              	query.description="Instrument"
              	query.order=""
              	query.filter="instrument_id=v_Instrument_ID"
              	query.options="N"
              	indx=instrument_tbl.query_create()
              	rec_count=indx.records_get()
              	
              	if rec_count=1 then
              		instrument_tbl.change_begin()
              			instrument_tbl.checkout_id=v_Checkout_ID
              		instrument_tbl.change_end()
              	end if
              	
              	instrument_tbl.close()
              	
              	e.javascript = e.javascript + crlf()
              	e.javascript = e.javascript + "var ele = $('{dialog.componentName}.V.R1.BUTTON_SUBMIT');"
              	e.javascript = e.javascript + "{dialog.object}.closeContainerWindow(ele);"
              	
              end if
              
              end function
              This is the code that I have on the button that is on dialog1 that opens dialog2. This code is on the onHide event:

              Code:
              recid = SESSION.INSTRUMENT_ID;
              {dialog.Object}.populateControlsFromTable(recid);
              I have a feeling that I am close. I think the problem is how I am loading recid.

              Thank you for your help,
              CPGood

              Comment


                #8
                Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

                Do you have the session variable 'published'? In properties, there is a 'Publish session variables' property where you publish the session variables you want available client side.

                I'm not sure if that is going to work for different records, as the session variables get published when the dialog is rendered, not when it's populated.

                I think a better approach would be to have a control on dialog1 that has the value of the current record id. If you have that, you could simply reference that control in your onHide event like:

                var recid = {dialog.Object}.getValue('INSTRUMENT_ID');
                {dialog.Object}.populateControlsFromTable(recid);

                -- provided 'INSTRUMENT_ID' is the name of the control variable.

                Another thing you can do to test if you have the correct record id (or any id at all), is put an alert in your onHide event.

                var recid = {dialog.Object}.getValue('INSTRUMENT_ID');
                alert('Record ID: ' + recid);
                - Dan Hooley
                - Custom Desktop or Web database development -

                Comment


                  #9
                  Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

                  I hate to say it but I am pretty certain this is fixed in v12 wherein it just "works" I don't know which update fixed it or actually if I am correct but again , I know it just works for me now and I have V12 latest build.
                  As a work around you may consider opening your selection as a grid component where you can just add a "new record" then select it - rather than an add new button opening a dialog (UX)

                  Actually if dialog 2 submits data that you now want to display in D1 you would need to go to the next record? or is the same record affected? If it is the same record, then you will need to refresh the page, or open the same parent UX as a secondary action. just some thoughts...mind you I do not give great advice - I am a total noob. But I do get it done at the end of the day...
                  NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                  Comment


                    #10
                    Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

                    Hi, thank you to everyone that helped with this. This is working now. On the OnHide event on dialog1 this code was added:

                    Code:
                    var data = {dialog.object}.getValue('INSTRUMENT_ID');
                    {dialog.object}.populateControlsFromTable(data,false,'','<Default>','<Default>');
                    I used one of the genies to build this in a different section of Alpha Five and then copied the javascript code to this section.

                    Thank you,
                    CPGood

                    Comment


                      #11
                      Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

                      Dan, I am trying to use this technique and keep getting that my javascript window variable is undefined. Would you be able to tell me what I'm doing wrong? I have a grid1 that has a hyperlink that can be clicked to load another grid, grid2, filtered by the row in grid1. I want my base filter on grid2 to be wide open though because it can be opened from other places. However, if not coming from grid1, I set an initial value in the search part of the grid and submit the search part in "ongridrendercomplete."

                      So my code in inline javascript that is run synchronously before the actionscript to open grid2, I have:

                      window['fromwhere'] = "Contact";

                      In my onGridRenderComplete event, I have:

                      var fromwhere = window['fromwhere'];
                      if (typeof fromwhere == 'undefined') {
                      setTimeout("{grid.Object}.submitSearchForm();",1000);
                      delete window['fromwhere'];
                      }

                      It does work in Working Preview, but not in the browser.

                      Can you see anything I'm doing wrong? I've tried so many ways to get this javascript variable to work!
                      Lisa

                      Comment


                        #12
                        Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

                        Lisa, I'm not sure I understand what your trying to do.

                        It doesn't appear you are using the variable anywhere other then checking if it's undefined, and then trying to delete it...

                        Your onGridRenderComplete event code is saying:
                        if fromwhere IS undefined (doesn't exist), then submit the search and delete the variable (that doesn't exist).

                        If you want to do something if the variable DOES exist, then you could say:
                        var fromwhere = window['fromwhere'];
                        if (typeof fromwhere != 'undefined') {
                        //use fromwhere
                        delete window['fromwhere'];
                        }
                        - Dan Hooley
                        - Custom Desktop or Web database development -

                        Comment


                          #13
                          Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

                          Thank you for your reply! This was one of my many variations and I was trying to use your example to see if I could get it to work. Basically, if "fromwhere" = 'Contact,' I don't want to apply the submitsearchform in grid2. I've tried adding an element to my grid2 freeform edit region to show the value of fromwhere when it gets to grid2. It works correctly in Working Preview, but not when run in any browser. This is the code I put in the OnGridRender event to show the value:
                          var x_var1='';
                          if(window['fromwhere']) x_var1 = window['fromwhere'];
                          else x_var1 = 'value not found';
                          $('E1').innerHTML = x_var1;

                          So "fromwhere" has a value in Working Preview but not in the browser. It seems like the variable really isn't global, right? Would that explain why it's working in Working Preview? I'm setting the variable in inline javascript prior to opening the grid in actions scripting as I mentioned. Is this not a global declaration?

                          Comment


                            #14
                            Re: How to Refresh Specific Fields on a Dialog after Closing a Dialog

                            I don't have a working model, but it sounds like a timing issue. Your onGridRender could be firing before the inline javascript.

                            Instead of using inline JavaScript, try using the Window JavaScript Events to set the value. In the button that opens the second grid, scroll down and use the onBeforeShow or onShow event.
                            - Dan Hooley
                            - Custom Desktop or Web database development -

                            Comment

                            Working...
                            X