9 Replies Latest reply on May 19, 2017 9:36 AM by yomango

    Click in a field, trigger a script, but don't type in it

    JohnGagne

      Hi, thank you in advance.

       

      I want a user to click in any repetition of a repeating field, triggering a script trigger (which uses the ActiveRepNumber as an index for other repeating fields).  The script trigger sets an 'X" in the repetition to indicate its selection to the user.

       

      It works great; but, it leaves you in the field where someone could type anything in the field, rather than the 'X," which the user can uncheck.

       

      To move the user off the field, I utilized a GO TO FIELD script command without specifying a field, which works, but it POPS a little.

       

      (Specifying a repeating field as a button does not seem to work.)

       

      If there isn't another way to prevent typing in the field, I may have to perform some additional scripting to clean up the input if I remove  the GO TO FIELD command allowing someone to then alter my "X" value.

       

      Any thoughts?

       

      I cant go to DEVCON.  I hope everyone who does go will have a great time!!  Take Care

      jg

        • 1. Re: Click in a field, trigger a script, but don't type in it
          wkeja

          Does this help:

           

          OnObjectEnter ScriptTrigger

           

          If [ table::field ≠ "x" ]

          Set Field [table::field; "x" ]

          Commit Records/Requests

          [ No dialog ]

          Else

          Set Field [ table::field; "" ]

          Commit Records/Requests

          [ No dialog ]

          End If

          1 of 1 people found this helpful
          • 2. Re: Click in a field, trigger a script, but don't type in it
            David Moyer

            Hi,

             

            What might work for you is what I used in my puzzle project.  I use an "overlay" - a transparent button that prevents entry into the field, but manipulates the field.

            For repeating fields, make another repeating field (say, text) of the same size and shape.  Place it directly over the repeating field containing data.  Then use the Get(ActiveRepetitionNumber) to retrieve the repetition.  I don't believe that the Get value can be sent as the script parameter to a triggered script.  You need to use the Get inside the script,

             

            For an example, please see my puzzle project:

            Surrender to Fun, with FileMaker

            1 of 1 people found this helpful
            • 3. Re: Click in a field, trigger a script, but don't type in it
              David Moyer

              More detail ...

              The underlying repeating field should be set to "no entry in browse mode".  The overlay should allow entry; and more importantly, should "OnObjectEnter" trigger a script that manipulates the underlying field.

              I hope this helps prevent the "pop".

              1 of 1 people found this helpful
              • 4. Re: Click in a field, trigger a script, but don't type in it
                JohnGagne

                Thanks wkeja.  But that leaves you in the field, and a person can also enter garbage.

                 

                David, I'm in a WEB Direct interface; and, I thought I remembered reading that WEB Direct does not like stacking objects on one another.  But, YES, I will have to try.  It is the easiest way to securely obtain a clean value.

                 

                If the stacking of objects is a problem, I'll have to perform some cleanup when leaving the field.

                 

                Let's hope a stacked button will be ok.

                 

                Thanks!!  Take care.

                 

                john

                • 5. Re: Click in a field, trigger a script, but don't type in it
                  JohnGagne

                  Oh yes, the commit might take me out of the field.

                   

                  I'll try that.

                   

                  Button overlay is nice.  But, I'm not sure you can stack objects in WEB Direct.

                   

                  Will try the commit.  (It's a repeating global field)

                   

                  If not, I'll try the button overlay.

                   

                  THANK YOU!!

                   

                  jg

                  • 6. Re: Click in a field, trigger a script, but don't type in it
                    karendweaver

                    Is there some reason you wouldn't format the field as a checkbox set with value "X"?  That would prevent other values being entered - the checkbox would be "X" if selected and "" if not selected.

                     

                    If you want to go with the stacked objects, you can use another script trigger for exiting the field. 

                     

                    Otherwise, more info on what you are trying to do might help.

                     

                    Karen

                    • 7. Re: Click in a field, trigger a script, but don't type in it
                      JohnGagne

                      Thanks.  It's not a field with various values.  It is a set of repeating fields.  There are other sets of repeating fields in the solution too.  So when a LEVEL is selected, it "instructs" the code to use that "level" or offset into the array across the board in all the other arrays too.

                       

                      Commit is so simple.  So simple I overlooked it.  It's utilized in a script trigger (enter object) so it does keep users from doing anything in there.  My script trigger code takes care of value assignments throughout the array.

                       

                      Thanks again.  Just spotted this reply tonight.

                       

                      Take care

                       

                      jg

                      • 9. Re: Click in a field, trigger a script, but don't type in it
                        yomango

                        Hi, Dave. Looking in the Forum for a guide to retrieve the value of a repeating field I came across your advise And thought I had the answer. I had tried several variations of my own but none worked. I'm not sure if I am applying your advise properly. I have a number repeating field (MOVIL#) with values in it. I want to click on any repeating number, get its value and execute a script. I placed, as you advised, a  transparent repeating text field (called it Repeating field) on top of the MOVIL# field. The script does get a a variable the Get(ActiveRepeatingNumber) from the text field, but when it gets the value from  MOVIL#, although it is told to go to the repetition number, it gets the first value of the field.
                        Here is the screen shot of the script and its behavior:

                        Can you tell what am I doing wrong.

                         

                        I appreciate any help you can give me