1 2 Previous Next 16 Replies Latest reply on Oct 6, 2016 12:58 PM by cisaac

    Show dropdown list using "Input Fields" in "Show Custom Dialog" Options

    evanscl

      Title

      Show dropdown list using "Input Fields" in "Show Custom Dialog" Options

      Post

           I created a Custom Dialog script with the option for the user to input data into a field, using the "Input Fields" option. When the Custom Dialog box appears in Browse Mode, I want the Input Field to show a dropdown list of valid values (legal values) for that field. As it is, only an edit box appears with no dropdown list.

           How do I get the Input Field in the Custom Dialog box to show a list of valid values for that field, using a dropdown list?

      CustomDialogBox_FMP13.jpg

        • 1. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
          philmodjunk

               This is a key limitation of custom dialogs. Only I unformatted edit boxes are possible. But you can use the new window script step to open a model window that uses a regular layout where the fields may be formatted like you need. 

          1 of 1 people found this helpful
          • 2. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
            evanscl

                 I am new to FileMaker, and I don't know how to implement your suggestion for using a New Window script step to show valid values (legal values) for a field, using Input Fields in the Custom Dialog box.

                 I read the description of the New Window script in "FileMaker Pro 13 Help"; however, the examples given don't seem to be similar to my need. Which "Advanced Style Option" (Document Window; Floating Document; Dialog Window) do I choose?

                 Would you mind adding the necessary lines of script to my script below so that valid choices for Bird::Sample Type 1 are presented to the user? My valid values for Bird::Sample Type 1 are: "Contaminated", "Equivocal", "Failed", "Lab Error", "NEG", "Not Tested", "Pending", "POS", "Suspect", "Unable to Interpret". Do I make a new layout with only the Bird::Sample Type 1 field, and if so, how do I make sure it fills in the field for the particular record I am on?

            If [Bird::NumberSampleTypes = 1]

            Show Custom Dialog ["Choose Sample Type"; "Choose the sample type."; Bird::SampleType1]

            Set Field [Bird::SampleType1_Result; "Pending"

            Clear [Select; Bird::SampleType2]

            Clear [Select; Bird::SampleType2_Result]

            End If

                 Thank you for your help.

            • 3. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
              philmodjunk

                   Before you create a script, you need to create a layout to use with your new window. Create a form view layout based on the table where you defined your input fields. Put your input fields on this layout and format them with a drop down list. Put two buttons labeled OK and Cancel on this layout. Make this a form view layout with just these few items located in the upper left corner of your layout. Set the OK button to do this one line script:

              Set Variable [$$Button ; value: "OK"]

                   Be sure to select the Resume option in the "current script" drop down for the OK button. Select Resume Script for the Cancel button.

                   Just as Show Custom Dialog opens a modal dialog, you want to use New Window to open a modal dialog.

                   Then your script becomes:

              If [Bird::NumberSampleTypes = 1]

              New Window [Name: "Choose Sample Type" ; Height: xxx ; Top: yyy ; Left: zzzz ; Right: rrr ; Style: Dialog ]
                   Go to Layout["SampleChoose" ; (Bird) ]

              Pause/Resume Script [Indefinitely]
                   If [$$Button = "OK" ]

                 Set Field [Bird::SampleType1_Result; "Pending"

                 Clear [Select; Bird::SampleType2]

                 Clear [Select; Bird::SampleType2_Result]
                      Set Variable [$$Button ; value: ""]

              End If

              End If

                   You'll need to work out what numbers work for Height, Width, etc as this will be determined by how you set up the layout to use with this window. You may need to do a bit of trial and error before the window size and placement works for what you want to see happen.

              • 4. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                evanscl
                       
                1.           I am using the script, Close Window, for the Cancel button; is this correct?
                2.      
                3.           When I run the new script, a duplicate window of the current window opens, as well as a window for my newly created window, "Choose Sample Type". When I choose the new sample type from the dropdown list, I receive an error message:

                     "This record cannot be modified in this window because it is already being modified in a different window." (See attached screenshot.) How do I avoid this error?

                NOTE: I am running this database from a remote server.

                • 5. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                  philmodjunk

                       You need to commit records in the first window before opening the second. And I forgot about the need to close the window. No, I would not set Cancel to close the window. Use this modified form of the script instead as you will also need to close the window when clicking OK.

                  If [Bird::NumberSampleTypes = 1]

                  Commit Records
                  New Window [Name: "Choose Sample Type" ; Height: xxx ; Top: yyy ; Left: zzzz ; Right: rrr ; Style: Dialog ]
                       Go to Layout["SampleChoose" ; (Bird) ]

                  Show/Hide Toolbars [Hide]
                  Pause/Resume Script [Indefinitely]
                  Close Window ["Choose Sample Type" ]
                  If [$$Button = "OK" ]

                     Set Field [Bird::SampleType1_Result; "Pending"

                     Clear [Select; Bird::SampleType2]

                     Clear [Select; Bird::SampleType2_Result]
                          Set Variable [$$Button ; value: ""]

                  End If

                  End If

                  • 6. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                    evanscl
                           
                    1.           What script do I use for the Cancel button?
                    2.      
                    3.           I am still receiving the error message, "This record cannot be modified in this window because it is already being modified in a different window." Is the error message occurring because the database is being accessed on a server? If so, does a work-around solution exist?
                    • 7. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                      philmodjunk

                           To quote from an earlier post:

                           

                                Select Resume Script for the Cancel button.

                      • 8. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                        evanscl
                               
                        1.           I am still receiving the error message, "This record cannot be modified in this window because it is already being modified in a different window."
                        • 9. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                          philmodjunk

                               Did you leave out the commit records step?

                          • 10. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                            evanscl

                                 I included the Commit Records step. See screenshot. {Note: I haven't included the Commit Records step in the 2nd IF statement, but I've only been testing the first IF statement.}

                            • 11. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                              philmodjunk

                                   And do you get this error message when NumberSampleTypes = 1 or NumberSampleTypes = 2?

                                   The code for opening a new window when the value is 2 is incomplete.

                              • 12. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                                evanscl

                                     A "New Window" script before the IF statements (IF Bird::NumberSampleTypes = 1 and IF Bird::NumberSampleTypes = 2) was incomplete. The "New Window" script needed to open a layout showing only one field, NumberSampleTypes, in order to establish whether or not there was 1 or 2 sample types before the IF statements could be evaluated.

                                     The script is working now (See Screenshot). As always, I really appreciate your help. 

                                • 13. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                                  cisaac

                                  I tried following the concept to this script, but my problem is that the script stays paused. How does the script know to resume, is that something I have to the OK button? Because I have a script on the OK to set the variable to "OK" and cannot have it do more than one action.

                                  • 14. Re: Show dropdown list using "Input Fields" in "Show Custom Dialog" Options
                                    philmodjunk

                                    The buttons are supposed to resume the script.

                                     

                                    Note the dates of the prior posts. This is a very old thread.

                                     

                                    Instead of a new window, these days I usually open a popover as this is simpler/faster to set up with less "detail management" needed and don't get greyed out scrollbars and other window border features that detract from the "dialog box" appearance that I'm after.

                                    1 2 Previous Next