4Justme2 Posted June 20, 2012 Posted June 20, 2012 Is there a way to validate a calendar pick... wherein the enduser gets a message if the date picked is not a Saturday?
eos Posted June 20, 2012 Posted June 20, 2012 Try the following script as OnObjectExit trigger: If [ DayOfWeek ( myTable::myDateField ) <> 7 ] Show Custom Dialog [ Please choose a date that is a Saturday.” , button “OK” ] Go to Field ( Select/perform; myTable::myDateField ] Halt Script End If This will keep the user in the field until they pick a Saturday date. If this merely intended as a message, remove the Go to Field (optionally) and Halt Script steps.
Raybaudi Posted June 20, 2012 Posted June 20, 2012 Is there a way to validate a calendar pick... You colud use this calculation for the validation option of that field: DayOfWeek ( Self ) = 7 1
4Justme2 Posted June 20, 2012 Author Posted June 20, 2012 Try the following script as OnObjectExit trigger: If [ DayOfWeek ( myTable::myDateField ) <> 7 ] Show Custom Dialog [ Please choose a date that is a Saturday.” , button “OK” ] Go to Field ( Select/perform; myTable::myDateField ] Halt Script End If This will keep the user in the field until they pick a Saturday date. If this merely intended as a message, remove the Go to Field (optionally) and Halt Script steps. This will work perfectly, thank you both for your help... mp
4Justme2 Posted June 20, 2012 Author Posted June 20, 2012 I'm doing something wrong. When I went to create the script I entered the folloiwng: If [ DayOfWeek ( _TIMECARD::WeekendingDate) <> 7 ] Show Custom Dialog [ Please choose a date that is a Saturday.” , button “OK” ] Go to Field ( Select/perform; _TIMECARD::WeekendingDate ] Halt Script End If When I go to save the script it highlights the If portion of the script and returns the message: "The specified table cannot be found". The name of my table is _TIMECARD so I'm confused why Iwould get this message. Any ideas?
eos Posted June 20, 2012 Posted June 20, 2012 When I go to save the script it highlights the If portion of the script and returns the message: "The specified table cannot be found". The name of my table is _TIMECARD so I'm confused why Iwould get this message. Any ideas? What does it read in the bar next to “Table:” when you switch to Layout mode? Not the table name is relevant, but the name of the TO the layout is based on. You can also switch to Layout mode, open the Layout Setup dialog and see the TO name next to the popup “Show Records from:”. (This is another example of FMI confusing people by inconsistently mixing “Table” and “Table Occurrence“ within the UI!) EDIT: Forget all that. What you did was probably copying my example text 1-to-1 into the Specify box for the Custom Dialog. FileMaker complains about a syntax error because there are not enough quotes. Write this text incl. quotes: "Please choose a date that is a Saturday.” Put the “OK” into the box labeled ”Default button”. This should work now. Forget the first two paragraphs.
comment Posted June 20, 2012 Posted June 20, 2012 Note that: 1. The If clause should end with Exit Script [False], rather than Halt Script - there may be other scripts running. If this is triggered OnObjectExit, the attempt to exit will be aborted, so the script can be shortened to: If [ DayOfWeek ( YourTable::Datefield ) ≠ 7 ] Show Custom Dialog [ ... ] Exit Script [ False ] End If 2. Running the script is no substitute to validating at data level. 1
4Justme2 Posted June 20, 2012 Author Posted June 20, 2012 EDIT: Forget all that. What you did was probably copying my example text 1-to-1 into the Specify box for the Custom Dialog. FileMaker complains about a syntax error because there are not enough quotes. Write this text incl. quotes: "Please choose a date that is a Saturday.” Put the “OK” into the box labeled ”Default button”. This should work now. Forget the first two paragraphs. That works BEAUTIFULLY! Many thanks once again... mp :laugh2:
Recommended Posts
This topic is 4596 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now