12 Replies Latest reply on Jun 12, 2017 8:15 AM by philmodjunk

    Reset Popover edit box

    Charlesdh

      HI,

       

      So far the file I'm working on with help is progressing.

      I created a "Popover" for find purpose. Now, however, after the find completes I need the value of the previous find removed when I use the popover again. Ie: I entered a value of "24" the script will find the value. But, the value will still show when I try to do another find for a different value.

      How can I do this. I can set a Variable that when the script runs it will clear the data so that I can use a different value? Or, is there another way?

       

      Charles

        • 1. Re: Reset Popover edit box
          dale_allyn

          Here's one way: In layout mode, you can select the popover element (double click its trigger button for example), and on the popover setup dialog chose "Set Script Triggers...". From the next dialog you can select a script to trigger "OnObjectClose" "OnObjectExit". Select a script (that you will need to create) which clears the field(s) you wish cleared.

           

          You can use the Set Field script step to set your field to "" (pair of double quotes with no space between) or set it to any other value you need. E.g. Set Field [myTable::myField ; "" ]

           

          HTH

          • 2. Re: Reset Popover edit box
            philmodjunk

            I use OnObjectOpen to clear the field each time the popover opens.

            • 3. Re: Reset Popover edit box
              dale_allyn

              Phils reply jogged my memory a bit: The script trigger will be OnObjectEnter or OnObjectExit (either will work, depending on when you want the clear to occur). I'll edit my above reply to reflect the correction.

               

              Additionally, you can use the "Clear" script step in a similar fashion, but I've had more reliable results with "Set Field" for some reason (but I haven't done comparisons recently).

              • 4. Re: Reset Popover edit box
                dale_allyn

                philmodjunk Other than being able to grab the last search string after a popover closes and, for example to set a variable and do something with it, is there an advantage to clearing on Enter rather than Exit? Just habit/personal preference? Something else that I'm missing?

                 

                My use of it on Exit has, in one particular case, been to have the popover open more smoothly (several fields to clear, plus some other steps), but I don't think I've noticed a difference in other cases. Just curious about your thoughts.

                1 of 1 people found this helpful
                • 5. Re: Reset Popover edit box
                  philmodjunk

                  It's preference to a large part, but it also leaves the "last value" in that field after the find has been performed so that you can access it again. I sometimes need that find criteria for other uses--such as displaying the find criteria as part of the report that it produced or so that I can set up a "modify the last find" type capability.

                   

                  About Clear vs. Set Field  as options to clear the field.

                   

                  There is one distinct difference between the two. Clear puts the cursor into the field that it clears. In fact, it won't clear the field at all if the field is not present on the current layout in order to do that. That's useful in this case since entering data into the field is likely to be the very next thing that you want to do after opening the popover, but this behavior can have unexpected side effects. You can actually use clear field to open a popover since putting the focus on an object in a popover panel opens the popover. The same thing can pop a tab or slide control panel to the front. It can also trip script triggers--which can be an undesirable result in some cases.

                   

                  I once put Clear field in my script to clear a popover into my script and then discovered that clicking the popover button opened a completely different popover. That was due to using the same global field for temporary data entry (as you do here to set up a find request), in two different popovers. I ended up using set field to clear the field and go to object to put the cursor into the field.

                  • 6. Re: Reset Popover edit box
                    philmodjunk

                    I just realized that I forgot the main reason I've gotten into the habit of clearing such fields "onObjectEnter". I support a complex, large scale solution that has several different developers working on it. Global fields in it are often tasked for different things on the same layout if "temporary data entry" is all that is needed. My story of the wrong popover opening is a case in point. So, at the time the user first opens the popover, that global field might have data in it left over from some other task. It might not be the case every time. It might be that a future change starts putting data in this global field as part of some other script.

                     

                    So clearing the field "onObectEnter" is the only way to be absolutely sure that the user will not see data in the field that should not be there.

                    2 of 2 people found this helpful
                    • 7. Re: Reset Popover edit box
                      dale_allyn

                      Thanks, Phil. All of your points make good sense. Thanks for sharing your preferences, experiences and use case(s).

                      • 8. Re: Reset Popover edit box
                        Charlesdh

                        Thanks to philmodjunk and dale_allyn for their help.  the info provided helped me.

                         

                        Charles

                        • 9. Re: Reset Popover edit box
                          kolvorok

                          I have some problems with this, too. The Set Field-step works best OnObjectEnter, but there is a delay when you see the data in the search-field (not global) and the related records in the portal. The Clear Field-step is even worser, the records in the portal doesn't go away before the searc-field no longer is active. I can't see that Freeze or Refresh Window works with Popover windows, either.

                           

                          I've also tried the Set Field-step with OnObjectExit, but since I'm using a button on the related records in the portal they are gone when the script runs.

                           

                          It seems that the best way is to blank the search field OnObjectEnter. But how to make this "invisible" for the user?

                          • 10. Re: Reset Popover edit box
                            philmodjunk

                            Don't see what you are seeing. But you could set up a regular button to run a script that first initializes fields and then uses Go to object to open the popover.

                            • 11. Re: Reset Popover edit box
                              kolvorok

                              I forgot to say that my database is on a server on a wireless network and maybe that could explain the delay. I'd think of an ordinary button, too, but then I presume it must be put on top of an "invisible" popover button...?

                              • 12. Re: Reset Popover edit box
                                philmodjunk

                                That would be one option. The simplest way is to set a Hide Object WHen expression on the popover button of True or the number 1. Then it's fully visible in Layout mode--which makes it easier to work with your layout.