...

View Full Version : Data Validation Question



blkshirt
12-28-2003, 06:19 AM
I'm not sure if this is 100% possible with Javascript or not and I don't have a ton of background with this script language.

Here's the problem I'm facing....

Pages are using php connected to a mysql db.

There is a drop down list box that will list Track and Field events (ex. 100 Meter Dash, Long Jump, 4x100m Relay, etc). The list box is populated from the database, because each meet can have different events.

Track and Field events are of specific type (Track, Field or Relay) this will help in the data validation and I use this in another place as well, in the site.

Question... Once a coach selects a specific event (we'll say the Long Jump) from the list box, is there any way that I can figure out what event is selected. Here's what I want to do in pseudocode...






Find selection by coach
Connect to db and find type of event
If type "track" then
do data validation for track event
If Incorect
Prompt User
Else
Accept Input
End If
End If

If type "relay" then
do data validation for relay event
If Incorect
Prompt User
Else
Accept Input
End If
End If

If type "field" then
do data validation for field event
If Incorect
Prompt User
Else
Accept Input
End If
End if





All entries would be of type string or varchar (depending how you look at it) You can't put it the inputs as of type Int because you may have to put times like 2:05.44 for the 800m this won't work because of the : and you can't use it for field events either because the format needs to be feet-inch.nearest quarter inch (22-11.75, for example)

I'm stumped as to how to figure this out so any help at all would be greatly appreciated.

Something in the future I'd like to do is be able to set a minimum and maximum value for an athletes best effort. So it would be nice to be able to incorporate that in the future...

beetle
12-28-2003, 08:15 AM
Certainly seems possible, but I must admit, I'm still a bit confused as to what you're trying to accomplish.

There's a SELECT element, with events in it, populated by the DB. Someone selects an event -- then what? The form submits? They click something else? It's the flow of events that confuse me.

maybe show me the HTML your PHP is producing, or give me a 1-2-3 type list of what needs to happen. Or better yet - gimme both =)

blkshirt
12-28-2003, 05:41 PM
Originally posted by beetle
Certainly seems possible, but I must admit, I'm still a bit confused as to what you're trying to accomplish.

There's a SELECT element, with events in it, populated by the DB. Someone selects an event -- then what? The form submits? They click something else? It's the flow of events that confuse me.

maybe show me the HTML your PHP is producing, or give me a 1-2-3 type list of what needs to happen. Or better yet - gimme both =)

Sorry about that...

I'll type it out because it will be faster this way...

Coach goes to the Meet Entry page, he/she's already selected the meet they will be submitting entries for.

Coach selects an event out of a drop down list box that is populated using php/mysql db. (no clicking)

Coach then selects an athlete that will participate in this event or the four memebers of the relay (if the event is a relay).

Coach then enters in a "consistent mark" for this athlete/relay for this event, via a text box.

Coach clicks "submit" data is sent to db and is shown to the coach higher up on the page.

I'd like to have the validation done when the coach hits the submit button, as I described above.

If this isn't enough information, let me know and I'll let you know where the pages are located that you'd need....



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum