1 2 Previous Next 22 Replies Latest reply on Oct 31, 2012 7:54 AM by Epa

    Custom dialog in a script

    Epa

      Title

      Custom dialog in a script

      Post

           I have 2 fields. 1 field is a date field for follow up calls.  The other field is a comments field in a portal.  When a user enters comments into the portal, I want a dialog to popup that says "Would you like to update the Follow Up Date?" With the following options "2 weeks" , "3 weeks" , "custom" , "Not now" .  "Custom" would put the cursor on the date field.  If a user selects 2 or 3 weeks, a calculation would run based on a date field in the same row as the comments field in the portal.  Is this possible? If so, can someone help me with the script! I'd have it run upon committing the comments field.

           Thanks

        • 1. Re: Custom dialog in a script
          philmodjunk

               The maximum number of buttons you can use in a custom dialog is 3. You are requesting 4 buttons.

               This means that you cannot use a custom dialog, but you can use new window to open a new window as a modal dialog where you can have as many buttons as you want. You can also put fields on this layout for data entry if that helps with the "custom" option.

               The details for getting the best results out of such a script with the New WIndow script step depend on the version of FileMaker and whether this is with a windows system where you keep the windows maximized or not.

          • 2. Re: Custom dialog in a script
            EP

                 I can use 3 buttons.  What kind of script would I be looking at?

                 thanks

            • 3. Re: Custom dialog in a script
              philmodjunk

                   Which of the three buttons would you use?

                   The basic script is:

                   Show Custom Dialog [//specify text message and buttons here]
                   If [Get ( LastMessageChoice ) = 1 ]

                   # do what you want when the default button (#1) is clicked here

                   Else If [ Get ( lastMessageChoice ) = 2 ]

                   # Do what you want to have happen when button #2 is clicked here

                   Else

                   # Do what you want ot have happen when button #3 is clicked here

                   End IF

              • 4. Re: Custom dialog in a script
                Sorbsbuster

                     You can, of course, string Phil's script to another one:

                     Custom Dialogue:  "Which size do you want?"

                     Large - Medium - Other

                     If [Get ( LastMessageChoice ) = 1 ]

                     # do what you want when the default button (#1) is clicked here

                     Else If [ Get ( lastMessageChoice ) = 2 ]

                     # Do what you want to have happen when button #2 is clicked here

                     Else

                                 Show Custom Dialog [ Medium - Small - Cancel]

                                      If [Get ( LastMessageChoice ) = 1 ]

                                      # do what you want when the default button (#1) is clicked here

                                      Else If [ Get ( lastMessageChoice ) = 2 ]

                                     # Do what you want to have happen when button #2 is clicked here

                                      Else

                                      Show Custom Dialog [ Medium - Small - Cancel]

                                      End IF

                     End IF

                • 5. Re: Custom dialog in a script
                  JimMac

                       Another way to do almost what you said using Phil's and Sorbuster's stringing ideas,

                       First Custom Dialog

                  "Would you like to update the Follow Up Date?"

                  [Not Now]       [OK]

                  If OK button selected  [using scriping logic  go to the next Custom Dialog]

                  If Not Now button selected [ Exit script ]

                       Second Custom Dialog [use the Date Fields as Input Fields on the Show Custom Dialog]

                  "Enter the date in Custom Date or Use preselected dates!"

                       [put input field and label as Custom Date]

                  [2 weeks]    [3 weeks]   [custom]

                        

                        

                       Then do the calculations base on which button was selected.

                       Jim...

                        

                        

                  • 6. Re: Custom dialog in a script
                    Epa

                         Thanks, all set up!  I set up the "custom" button to Go to Field, in an attempt to make the drop down calendar.....drop down, so the user can enter the custom date.  However, it isn't behaving this way.  Any suggestions?

                    • 7. Re: Custom dialog in a script
                      philmodjunk

                           If you want to apply formats or value lists to the data in your custom dialog, you can't use a custom dialog. You'll need to use new window to open a small modal window for entering the data.

                           If you want to go that route, please indicate what version of FileMaker you are using and whether or not you have set up your system on the Windows Platform with maximized windows.

                      • 8. Re: Custom dialog in a script
                        Epa

                             Sorry, let me explain more.  If the user selects "custom" I want the cursor to go to the "Follow-up Date" field.  When it goes to this field on the layout, I want the calendar to drop down (which is what it does when I click on it).  When "custom" is clicked, the custom dialogs are gone and the script exits after it goes to the follow-up date field on the layout (where I want the calendar to drop down from the field).

                        • 9. Re: Custom dialog in a script
                          philmodjunk

                               When you used Go to field, did you click the "select/Perform" check box?

                               And did you select the "include icon to show or hide calendar" option for the field on your layout?

                          • 10. Re: Custom dialog in a script
                            Epa

                                 I clicked the select/perform box and nothing. Also tried with it unclicked.  I tried with and without the calendar icon.  I think the problem is that the cursor isn't actually going to the field....

                            • 11. Re: Custom dialog in a script
                              philmodjunk

                                   You should see the cursor in the field when the script completes unless something is interfering to prevent it. Is this all kicked off by a script trigger?

                                   I seem to recall that but forget the details...

                              • 12. Re: Custom dialog in a script
                                Epa

                                     Yes it is kicked off by a script trigger upon ObjectSave on a comments field.   Everything works except the Go To Field part of my script when button 3 ("custom") is clicked.  

                                • 13. Re: Custom dialog in a script
                                  Epa

                                       I have 2 scripts here....upon ObjectSave script 1 is kicked off: Do you want to update the follow up date? [OK]   [Not Now]

                                       when [OK] is clicked, script 2 runs with 3 buttons: [2 Weeks]  [4 Weeks]   [Custom]

                                  • 14. Re: Custom dialog in a script
                                    Epa

                                         I think I found the problem: when committing the comments field, it doesn't completely exit before the custom dialog pops up, preventing the cursor from going to the date field.  Is there something I can put in my script to "Exit Field"?

                                    1 2 Previous Next