edocx Posted March 10, 2009 Posted March 10, 2009 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.
edocx Posted March 11, 2009 Author Posted March 11, 2009 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
comment Posted March 11, 2009 Posted March 11, 2009 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.
edocx Posted March 11, 2009 Author Posted March 11, 2009 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.
Recommended Posts
This topic is 6010 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