Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate before form insert....

Status
Not open for further replies.

jojo79

Programmer
Oct 11, 2006
40
US
I am trying to validate a for before it is inserted. I need it to check a table in a SQL database if a record is already inserted.

Example.

I insert into my table through an asp form. I enter skew_no and order_no. I need to make sure that that combo is not already in the table. Now the order number can be inserted as many time as it wants as long as it has a different skew_no and so on the other way. I have looked many many many places with no luck, I am kind of looking for some kinda of directions. Thank you
 
This kind of validation isn't typically handled by javascript. Your form would need to submit to the server. The server then checks to see if the combination exists in the database, if it does then you would need to redraw the page and put an error message out saying that nothing was changed.

Typically, form validation that is handled via javascript ensures that no fields were left blank, or make sure that you don't put letters into a number field or something like that. Although javascript can communicate with the server, I wouldn't suggest using it in this situation.

If you are adamant about trapping this case client-side using javascript, then you are going to need an ajax solution. That being the case, you are probably better off asking your question in that forum: forum1600

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top