9 Replies Latest reply on Apr 21, 2014 10:40 AM by pademo57

    Popover Button Won't Store Option

    pademo57

      Title

      Popover Button Won't Store Option

      Post

           HI There,

           I have tried to include a popover button on my layout which would pop-up and a selection of 4 items would be inside. When the user clicks on one of the items, (what I was hoping would happen) is the popover would close and the item would show up in the field.

           Can someone walk me through how something like this should work please?

        • 1. Re: Popover Button Won't Store Option
          philmodjunk

               Place your field on top of the pop over button and use Behavior settings in the Inspector to remove Browse mode access.

               You can then place another copy of the field inside the popover frame with a radio button format with the 4 items, 4 values in the value list specified for the radio button.

               Use the OnObjectModify trigger on this radio button formatted copy of the field to perform a script with the Close Popover script step.

               Other combinations of controls can also be placed in the popover to modify the value of this field. In one of my iPhone solutions, tapping the field opens a popover with a copy of the field between two buttons labeled with + and -. Tapping a button adds or subtracts 1 from the value in the field and then closes the popover.

          • 2. Re: Popover Button Won't Store Option
            pademo57

                 Thanks PhilModJunk,

                 That works well. Although I was wondering instead of using radio buttons, is it possible to click on one of the four fields in the popover and have it close the popover and return the field selected to the original field?

                  

            • 3. Re: Popover Button Won't Store Option
              philmodjunk

                   Yes, just use Button Setup... in the Format menu to turn each field into a button. The value of the clicked field can be passed to the script as a script parameter. Set up the script to use set field to set the original field to this value that was passed as a script parameter and then close the popover:

                   Set Field [YourTable::Field ; Get ( ScriptParameter ) ]
                   Close Popover

              • 4. Re: Popover Button Won't Store Option
                pademo57

                     Thanks again PhilModJunk,

                     Your answer makes perfect sense but two questions(please see the enclosed jpeg):

                     1) When I click on the button, for example, "A" in the diagram. I set it up to run a script called "ButtonA".

                     The script says:

                     Set Field [tbl_Process::fld_ProcessName["A"]]

                     Close Popover

                     Yes, the popover closes but it doesn't put an A in the field, instead the field is outlined in blue. So I'm not sure what I did wrong?

                     2) Is it possible to Set Field for more than one field? In this case Amount as well?

                      

                • 5. Re: Popover Button Won't Store Option
                  pademo57

                       Sorry I forgot to mention the Button over top of "A" in the diagram says Perform Script ButtonA.

                  • 6. Re: Popover Button Won't Store Option
                    philmodjunk

                         The extra pair of square brackets indicates that your set field step is not set up correctly.

                         When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

                    • 7. Re: Popover Button Won't Store Option
                      pademo57

                      I'm sorry PhilModJunk to keep bothering on this point, but it is working sort of...

                           I created a script outside of any popover or button which I called 'ButtonA"
                            
                           In the new script I chose:
                           Set Field []
                           Then I clicked on the Specify button beside Specify Target Field:
                           I clicked on the field fld_ProcessName. 
                           I clicked on OK
                           Then I clicked on Calculated Result which opened up a window "Specify Calculation"
                           I did NOT see a semicolon (;) anywhere in the window
                           I tried typing A, then "A". Then a window would pop up saying:
                           "The specified field cannot be found."
                            
                           However, when I tried typing ="A"
                           A new window popped up saying:"A number, text constant, field name ..." and it highlighted the equal sign.
                           When I deleted the equal sign IT WORKED!
                            
                           I'm not sure what I am doing wrong but now I noticed the semicolon and the "A" wrapped in the one set of brackets in the script steps and it is working.
                            
                           So thanks for you help but if you have a comment on all this and what I am doing wrong it would be greatly appreciated.
                            
                            
                      • 8. Re: Popover Button Won't Store Option
                        philmodjunk

                             It doesn't sound like you are doing anything wrong. "A" is the correct syntax and it's putting that letter into the field as you wanted it to.

                             = "A" is interpreted by FileMaker as a calculation with a missing term. ( Table::Field = "A" is an example of correct syntax using an = operator and would return a value of 1 if there is a single letter "A" in the field.)

                             The letter A without quotes is interpreted as either a reference to a field or a function. Since it isn't the name of either in your case, you get an error message.

                             Thus:

                             "A"

                             is all you should have as your "calculated result".

                             But what I recommended was to pass "A" as a script parameter to the script. Then you can use one script for all four buttons and just set each button to pass a different letter in the optional script parameter box.

                             Your set field step then becomes:

                             Set Field [ YourTable::fld_ProcessName ; Get ( ScriptParameter ) ]

                             This is strictly an option, 4 different scripts for the 4 different buttons will do the job just fine. wink

                        • 9. Re: Popover Button Won't Store Option
                          pademo57

                               Thanks (yet again) PhilModJunk,

                               I finally figured out what I have been doing wrong.

                               When I was first creating the script I couldn't find the Optional Script Parameter.

                               It was after I went back in to Edit the Popover and when I clicked on Specify Script and a new window popped up, I finally saw the "Optional Script Parameter."

                               Oh brother, I'm so sorry to have put you through all this. Eventually it does sink in to my brain.  So yes, I will use your suggestion and NOT create a script for each individual button. Thanks again!