6 Replies Latest reply on Apr 6, 2014 10:30 AM by lijnbach

    Hiding button when not having the focus



      Hiding button when not having the focus


           Hello everyone,

           I have a lay out with two global fields and a button. The first field is starting date, the second field is ending date, and the OK button provides a list.

           But, if a user changes the dates, and directly pushes the OK Button, de OK Button does not have the focus, so the provided list is not correct because the last change did not take place. (The focus is still on one of the dates).

           Is there a way to hide the OK Button as long as it does not have the focus? I can't find it. Or, can I force to get the focus on the button before clicking it?


           Hans Lijnbach

        • 1. Re: Hiding button when not having the focus

               Clicking on a button does not put the focus on that button as you have discovered. This is by design so that you can put the cursor in a field and then click a button to perform a script that alters whichever field still has the focus.

               What is not clear to me is why it matters whether or not the button has the focus. The button's script can check the two date fields and do nothing or display an error message if the two fields do not have valid dates. A conditional format can change the text color of label text in the button from black to a shade of grey to show it as "disabled" to let the user know that the correct data has not yet been entered. (But this is just an appearance change, you still have to include scripting that checks the values in the fields to so that nothing happens if the button is "greyed out".)

          • 2. Re: Hiding button when not having the focus

                 Hai Phil,

                 Thanks for your respons.

                 What happens (e.g.) is that the user is in the second field (ending date), and changed the second field. After this change the user is pushing directly the OK button. (without leaving the second field with the tab). (The button is providing a list). The dates are still valid, but the last change of the second field did not take place because the focus is still on the second field. By the way, the dates are global fields. I discovered that I don't have this problem with normal fields in a table. (I have, like you suggested, all my global fields in a separated table).

                 I also have buttons in other lay outs, and in those cases the button performs a script and the last change of the field the cursor is in, does take place. But not if it is a global field.


            • 3. Re: Hiding button when not having the focus

                   I don't see what that would create a problem, but if needed, the first line of your script can be Commit Records to make sure that the change to data in the second field has been committed to the database.

              • 4. Re: Hiding button when not having the focus

                     O.K. Phil,

                     It is not a big problem, except that the user does not get the right list. No errors, just the wrong list.

                     What you suggested, Commit Records, I tried that, and it is working. To be honest, I couldn't find this one again because of the translation. Works fine. Thanks Phil. (In Dutch: Record/verzoek vastleggen ???)


                • 5. Re: Hiding button when not having the focus

                       I don't know what they call it in the Dutch version, but when you look at the list of script steps in the script editor, it's the Eighth item listed in the Records Category.

                  • 6. Re: Hiding button when not having the focus

                         I found it Phil,

                         Maybe it is not only the way they translated it, but also the fact that I am so used to the English expressions, that I have problems finding the Dutch versions of these expressions. As I started in the IT industry, 38 years ago, everything was in English, there were no Dutch versions. And when possible, I still use English versions, although Dutch versions are available. But also the forum is in English, so as far as I am concerned, we keep everything in English.

                         Thanks for your effort Phil.