March 10, 200916 yr I'm trying to design a script trigger that would whenever the date in field "date1" is a Sunday would allow returning the cursor to the field "date1" clearing the field content and displaying a message stating a Sunday date was just entered please correct. The only lines of code I believe I have completed is: DayName(Get ( ActiveFieldContents ))="Sunday" as well as the message. This script being the basis I would then like to repurpose it in "date2" without hard coding the field the field name. I would greatly appreciate any assistance I can receive with this procedure.
March 11, 200916 yr Author I did work on a solution myself.The following is my script. I still hope to see some feedback. Script is set to trigger on object exit. I did give the object(field) the same name as the field because I couldn't see how to return to the active field name without using go to object. CheckDay If [ DayName(Get ( ActiveFieldContents ))="Sunday" ] Set Variable [ $FieldName; Value:Get ( ActiveFieldName ) ] Show Custom Dialog [ Title: "Edit:" & " " & Quote ("Date"); Message: "Please Review Entry...Date Entered Is A Sunday"; Buttons: “OK” ] Go to Object [ Object Name: "$FieldName" ] Clear [ ] [ Select ] Go to Previous Field Go to Next Field Set Field By Name [ Get ( ActiveFieldTableName) & "::" & Get ( ActiveFieldName ); Get ( CurrentDate ] Halt Script End If
March 11, 200916 yr How about something simple: If [ DayOfWeek ( GetField ( Get ( ActiveFieldName ) ) ) = 1 ] Show Custom Dialog [ "Please review..." ] Clear [ Select ] Exit Script [ Result: False ] End If Run this script OnObjectSave. Note that this is not a replacement for field validation.
March 11, 200916 yr Author Thank you for the streamlined script. It worked very well. I just have one more question: I have the calendar attached to the date field is there an easier way to reselect the field so the calendar pops up if the date needs to be modified? Now I'm using go to previous field go to next field to have the calendar pop-up.
Create an account or sign in to comment