11 Replies Latest reply on Sep 4, 2010 3:32 AM by LaRetta_1

    Dialog Box

    developerS

      Title

      Dialog Box

      Post

      Hi,

      I am working with Filemaker Pro. I want to know if there is there a way that I can script the dialog box in a way that it is a multiple choice question?

      For example: the question would be "Are you familiar with Filemaker?" and there would be three radio buttons "Yes, No, a little bit".

      Is there a way to do this??

      Thanks!

        • 1. Re: Dialog Box
          LaRetta_1

          Probably the best approach would be to use the visibility technique, ie, after they specify yes or no to the 'Are you familiar' question, if the answer is yes, then the next radio button field would appear. 

          If using vs. 11 (with filtered portals) then this is simply:  filter the portal with boolean calculation with: FamiliarField = "Yes"

          ... and then the radio button field would appear only on records where the prior 'Familiar' field is yes.

          If prior to vs. 11, you can use this technique: 

          http://www.databasepros.com/FMPro?-DB=resources.fp5&-lay=cgi&-format=list.html&-FIND=+&resource_id=DBPros000743

          • 2. Re: Dialog Box
            developerS

            Im not sure if I umderstand, or you understood what Im trying to do. My database includes a list of students taking an examination.

            Now the students are already in the system, however, say at the last minute we decided to add another student. We can add their name. Now once this is done, I want a dialog box to pop up and say please specify (Sex: o Male o Female).

            Is this the feature you are talking about?

            Now I know that I can get a dialog box to pop up, and I can press "OK", "Cancel", "Continue" (You can add up to three buttons) Can those be radio buttons? If not, can you script the buttons that "If[ButtonPressed = OK]" it goes to a certain layout.

            Am I making sense?

            Thanks!

            • 3. Re: Dialog Box
              LaRetta_1

              I'm afraid not. You first want two questions and the second question to only show if the answer is yes to the first question.  Now you just want radio button for gender?

              Anyway, you can use value list to define your radio button.  And/or you can use custom dialog to have user specify whether male or female and go to the proper layout depending upon their answer.  So let's assume that the default button on the custom dialog is Female (smile, as it should be).  And the second button is Male; second as it should be (smile).  Your script would look something like:

              Show Custom Dialog [ "Female" ; "Male" ; "Which gender?" ]

              ... you would label your buttons Female and Male

              If [ Get ( LastMessageChoice ) = 1 ]

              ... #  the User selected Female (button 1)

              Go To Layout [ layout for Females ]

              Else

              Go To Layout [ layout for Males ]

              End If

              ... now ... I have assumed there are only two genders so the default remaining result is presumed to be Male.  My sample I provided is using a technique called visibility - where, on your form layout, you only want questions about pregnancy to appear if the person selected Female (for example).  Otherwise, if they select Male, those several fields about pregnancy or applying to females wouldn't even show on the form.  The same could be done for males.  Therefore, there is no need to design specific layouts for each (unless there are a lot of fields which would only pertain to one gender.

              • 4. Re: Dialog Box
                symbister

                You could try Get (LastMessageChoice) to trap the response to the Dialog Box, then direct the script based on response....either 1,2 or 3 based on first, second or third button clicked.

                not exactly radio buttons, but could be a work-around

                • 5. Re: Dialog Box
                  developerS

                  Dear Symbister,

                  This is exactly what I wanted! However, for some reason it prompts me to make the selection twice (i.e. The dialog box pops up twice). Here is my script:

                  GoToLayout["HomePage"(HomePage)]

                  ShowCustomDialog["Sex","Please Select one of the following"]

                  SetVariable[$$Sex;Value:Get(LastMessageChoice)]

                  GoToLayout["Students"(Students)]

                  SetField[Students::Sex;$$Sex]

                  GoToLayout["HomePage"(HomePage)]

                  Why is the dialog box popping up twice? Can you tell me if I'm doing anything wrong?

                  Thank you!

                  • 6. Re: Dialog Box
                    developerS

                    LaRetta, 

                    I also used your script and it works!! I am still having trouble with the dialog box popping up twice, for some reason. It prompts the user to select the gender twice. I select female, it then pops up again and I have to select female for it to actually set the field.

                    Thanks a lot for all the help!

                    • 7. Re: Dialog Box
                      symbister

                      mmm I'm not sure - but I do know that Get(LastMessageChoice) returns a number, and it seems you're trying to set a text field (Students::Sex)

                      Maybe try Set Field (Students::Sex; Case (Get(LastMessageChoice) = 1 ; "Male" ; Get(LastMessageChoice) = 2 ; "Female")

                      as to why the dialog pops up twice, I'd have to yield to a higher authority.. it doesn't on a test script i just tried.

                      :)

                      • 8. Re: Dialog Box
                        developerS

                        OOH! Never mind I fixed it! :) Thank you so much for all the help! Greatly appreciated! :)

                        • 9. Re: Dialog Box
                          developerS

                          Hi LaRetta,

                          As a follow up on the previous post, How to I use the show/hide fields feature based on at script trigger?

                          I would like to set a script that is triggered '"OnObjectModify". It will show the hidden box ( Age field).

                          This will be an edit box and the user will manually enter their age.

                          • 10. Re: Dialog Box
                            developerS

                            Thank you

                            • 11. Re: Dialog Box
                              LaRetta_1

                              When using vs. 11's technique on a filtered portal, script trigger OnObjectModify would be Refresh Window [flush cached join results]