12 Replies Latest reply on Feb 15, 2011 4:20 PM by philmodjunk

    Yes or No Field with Script

    ZoocMan85

      Title

      Yes or No Field with Script

      Post

      Hey Everyone,

       

       I have two fields... one that's a yes or no field with the bullets and then bellow a second field with a value list if the user selects yes from the above field. Right now i have a script set for when a user picks yes on field one... it automatically takes you to field 2... For example..  Field 1.. Are you sick ? yes or no  If yes go to field 2 and tell me what kind of sickness... if no move to next field... However what I'm trying to accomplish here is to have that field grayed out until the user hits yes in field one. If the user his no.. then no data can be entered into it. The field would be locked. Want to try to remove the ability for user error. Thanks

      Ray Z

        • 1. Re: Yes or No Field with Script
          Abhaya

          Hello Raz,

          You requirment is bef'r clicking on the yes/no field  it must be gray and after clicking  no color is in this field ok

          So you just condition formating on that radio button set that if empty then color otherwise no color.

          Then in your script just add some more things that when no button is clicked then the next  field is locked.

          thanks

          • 2. Re: Yes or No Field with Script
            ZoocMan85

            I appreciate the help but im still lost. I want the option for field 2 to be greyed out before any option... To make it simple... That field needs to be locked. Only way it opens if you hit yes on field one to the yes or no bullet. How do i do this?

            • 3. Re: Yes or No Field with Script
              philmodjunk

              Turning it Grey won't lock the field in FileMaker. You can, however, apply a conditional format to show it as grey and then use a script attached to a script trigger to move the cursor on to the next field in the tab order to "lock" the field.

              If [YourTable::yourfield = "no"]
                 Go To Next Field
              End If

              is all that's needed for the script trigger's script. (Use OnObjectEnter)

              Right click the field while in layout mode and select conditional format. Use the same expression: YourTable::yourfield = "no" and you can specify a grey text and/or fill color to grey out the field.

              • 4. Re: Yes or No Field with Script
                ZoocMan85

                Thats what i have setup as of now... I can careless about the grey part i just dont want data to be entered into that field if no is selected. Thats why im saying i wanted it locked with the color grey to show the users that data cant be entered.

                • 5. Re: Yes or No Field with Script
                  philmodjunk

                  You have the script with script trigger setup?

                  That's what is supposed to keep users from entering the field if the value "no" was selected in your field. As you said, the grey color conditional format is just a visual cue to the user.

                  • 6. Re: Yes or No Field with Script
                    ZoocMan85

                    Is there a way in the script to have the field locked prior ? So in the scipt i can put... If field medicaid = yes go to next field and have it unlock?

                    • 7. Re: Yes or No Field with Script
                      philmodjunk

                      I don't see the logic to that. If the yes/no field = "no" the field is locked. If you change it back to "yes" the script does nothing and the field is accessible.

                      • 8. Re: Yes or No Field with Script
                        ZoocMan85

                        Fields:

                          Medicaid: Yes or No  <If yes move to next field and unlock to select choice otherwise go to next field. Type of Mediaid would not be in tab order.

                          Type of Medicaid  ( Drop Down List)       <----- This field locked until above is set to yes.

                         

                         

                        This is what im trying to do.

                        • 9. Re: Yes or No Field with Script
                          philmodjunk

                          And that's what this script handles except that you've now specified that it not be in the tab order.

                          Set up this script with the OnObjectExit script trigger for the medicaid field:

                          If [YourTable:Medicaid = "Yes"]
                             Go To Field [//specify the drop down list field]
                             Exit Script [false]
                          End If

                          Keep the other triggered script set on the drop down list with OnObjectEnter as it's the simplest way to control access to the drop down list field should the user click on the field.

                          • 10. Re: Yes or No Field with Script
                            ZoocMan85

                            on the type of medicaid field... what do i put on that for a script?

                            • 11. Re: Yes or No Field with Script
                              ZoocMan85

                              What i did so far... I have on yes or no box the scipt you told me to... It then goes down to next field which is type of medicaid however, if a user selects no at top... they still have the option to select the type of medicaid... This is what i dont want so what kind of script do i put on type of medicaid?

                              • 12. Re: Yes or No Field with Script
                                philmodjunk

                                You said that you'd removed that field from the tab order. If it's not in the tab order, the only access to the field is with a mouse click (or via a script, but we don't have that here).

                                This is the script that is supposed to deny access if you click on the field:

                                If [YourTable:Medicaid = "no"]
                                   Go To Next Field
                                End If

                                This should kick the user out of the field if you've entered "no" for the medicaid field.