crazybake Posted August 18, 2009 Posted August 18, 2009 I am trying to use validation for students and inventory items. I have 3 tables: students, inventory and line items. Within the line items table I have a layout called "checkout." The first field in the checkout is studentID (which is also the join field) and a "go" button next to it. When the "go" button is hit, I want it to check against the student table StudentID. I created the validation area for the field and all seems to be except... when I hit the go button, it goes straight to the other layout without validation. However, if I click away from the field, it will check. How do I automate this? thanks
bcooney Posted August 18, 2009 Posted August 18, 2009 What do you mean by "check against the Student table StudentID?"
crazybake Posted August 18, 2009 Author Posted August 18, 2009 Sorry, a little convoluted. I have a field: Students:StudentID it is related to LineItems:StudentID. a single field layout in lineItems requests the user to enter the StudentID. I have validation setup as a calculation where LineItems:StudentID = Students:StudentID. If it fails, it is supposed to display a dialog box: "There is no student with that ID." There is also a button that will bring them to a different layout. I do not want it to go to that layout if it fails the validation. I am not setting this up right. If I enter an ID and hit the go button, it goes right to the new layout. Is there a script step that I can use to prevent it from going to the new layout if it fails validation? I hope that is a bit more clear.
bcooney Posted August 18, 2009 Posted August 18, 2009 (edited) Why aren't you using a value list to select a studentID in line items? Maybe the demos in this thread will help. Edited August 18, 2009 by Guest
crazybake Posted August 18, 2009 Author Posted August 18, 2009 I thought about a value list to begin with. I chose not to use this approach because there are 1,000 students, half of which change every year. I still can, but I was hoping to continue in this direction.
JesseSFR Posted August 19, 2009 Posted August 19, 2009 Your problem is that when you click the button your record does not commit. This is just one of those little FileMakerisms that you don't always see so it's tough to figure out. So to fix this just add a commit record to the top of your script. Then add an if statement around your go to related record step or go to layout step that makes sure the last error is 0. I put two versions of the script in the attached file. One of which uses a variable for the error which is just my particular preference. I also think that you need to switch your validation to be against a valuelist that is of the student::id's Hope this helps StudentTest.fp7.zip
Recommended Posts
This topic is 5634 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