6 Replies Latest reply on Aug 29, 2013 2:46 PM by barenose

    Built-in drop down calendar

    barenose

      Does anyone have any suggestions about how to change the functionality of the drop down calendar?

       

      For example: I have two date fields.

       

      Field one = start date

      Field two = end date

       

      If I put 09/01/2013 in Field one, I would like Field two to open the calendar in September, not in the current date, which may be August, etc.

       

      I have tried conditional formatting:

       

      If (IsValid ( Field one); Field one + 5 ; Get ( CurrentDate ))

       

      but that didn't have any effect. I could try a script trigger and see if that works.

       

      Any suggestions would be greatly appreciated.

        • 1. Re: Built-in drop down calendar
          BowdenData

          Script triggers as you have thought about.

           

          Doug

           

          Sent from my iPhone

          • 2. Re: Built-in drop down calendar
            barenose

            Hi Doug,

             

            The script trigger works, but the drop down calendar still reflects the current month. That can be confusing. Can you think of anywat to get the calendar to reflect the date in the field?

             

            Thanks for the quick response!

            • 3. Re: Built-in drop down calendar
              Stephen Huston

              In your triggered script, if you use a SetField script step and Commit the record before then doing the step to GoToField for EndDate, won't the calendar reflect the month of the entered/committed EndDate field?

              • 4. Re: Built-in drop down calendar
                keywords

                  If (IsValid ( Field one); Field one + 5 ; Get ( CurrentDate ))

                 

                The reason this did not work may be that IsValid() only traps for non-date contents; an empty field will pass. As for the drop down calendar defaults to today's date if the field is empty when you enter it.

                 

                Why not try setting Field two to autoenter by calc of Field one + 5? That way, as soon as you enter a date in Field one, Field two will be populated with a later date, and the drop down calendar will reflect that.

                • 5. Re: Built-in drop down calendar
                  raybaudi

                  Which is the script you wrote to be fired by the trigger?

                  Something like this, fired by OnObjectExit trigger of StartDate?

                   

                  If [ YourTable::StartDate ]

                    Set Field [ YourTable::EndDate ; YourTable::StartDate + 5 ]

                    Set Selection [ YourTable::EndDate ; Start Position: 1 ; End Position: 10 ] *

                    Exit Script [ Result: 0 ] **

                  End If

                   

                  * You can't do without it because otherwise the chosen calendar date will be rejected by FileMaker ( in effect it will be something like StartDate + 5 & "the chosen date" )

                  ** You can't do without it because otherwise the cursor will go to the next field in the tab order, instead of remaining in the field EndDate.

                  • 6. Re: Built-in drop down calendar
                    barenose

                    Thanks all,

                     

                    I set Field two to auto enter, and that did the trick! My script is the same as that proposed by Daniele, without the  Set Selection line.

                     

                    Thanks everyone!