Script triggers as you have thought about.
Sent from my iPhone
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!
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?
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.
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 ] **
* 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.
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.