4 Replies Latest reply on Dec 1, 2009 9:23 AM by philmodjunk

    Create buttons to insert text to multiple fields

    nolak37

      Title

      Create buttons to insert text to multiple fields

      Post

      I have created a set of buttons containing the numbers 0-9 and the letters D, W, M, Y for day, week, month and year.

       Each Button is set to "insert text" to the same field.

       

      This works well however im now in a situation where I will need to do the same thing for other fields in other layouts.

       

      I can copy this set of buttons and add it to another layout then I must go one button at a time and change the field to which the information is inserted.

       

      Is there an easier way to do this?

        • 1. Re: Create buttons to insert text to multiple fields
          mrvodka
            

          Try using Go to Object followed by Set Field []. Dont specify a target field for the Set Field.

           

          Another option would be to use Set Field by Name and read in the fields that you want.

          • 2. Re: Create buttons to insert text to multiple fields
            nolak37
              

            mr_vodka wrote:

            Try using Go to Object followed by Set Field []. Dont specify a target field for the Set Field.


            I tried this and bothing happened, On "go to object" im not supposed to specity which object correct.

             

            Also on your other option, what do you mean by "read in the fields that you want", if i list all the fields will this not enter the same value in all fields simultaneously?


            • 3. Re: Create buttons to insert text to multiple fields
              mrvodka
                

              You need to name all the fields that you want on each layout with an object name. This can be done through the Object Info Pallette. So lets say you name 5 fields with the object names A-E.

               

              Your Script would be something like:

               

              Go To Object ["A"]

              Set Field ["This is your first value"]

               

              Go To Object ["B"]

              Set Field ["This is your second value"]

               

              Go To Object ["C"]

              Set Field ["This is your third value"]

               

               

              etc etc. Now as long as you name each object in all your layouts, you can set the same values each time.

               

               

              • 4. Re: Create buttons to insert text to multiple fields
                philmodjunk
                  

                You can also pass object or field names as parameters you specify using Button Setup... This approach allows you to copy and paste your buttons to different layouts, and then double click the buttons to enter an object or field name as a parameter.

                 

                Using object names like Mr. Vodka describes:

                 

                Go To Object [ Get ( ScriptParameter ) ]

                Set Field[.....

                 

                This is easiest to implement if your button is to modify only one field. If you need one click to modify multiple fields, you could list all in one parameter "A B C" and then use code to extract one object name at a time in a loop.