![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Best way to validate forms?
Does anyone have any tricks/tips on validating forms (no plugins)?
There doesn't really seem to be any universal way to make a javascript function that will suit everything, you almost have to hard code form/input names into the function, which is nasty if you're going to be working with a lot of forms in a project. I mean I could make something that checks for empty fields or validates an email address but what if I need to see if a <select> listbox value=="this" and if it does then make sure this <input> field=="this".. things would get really messy.. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Plus you have to worry about people doing malicious things and getting past your javascript validation so you have to also pass everything through PHP or something.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Carpe Visio
Industry Role:
Join Date: Jul 2002
Location: New York
Posts: 43,061
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
ICQ:649699063
Industry Role:
Join Date: Mar 2003
Posts: 27,763
|
jquery - I guess that's it.
__________________
Send me an email: [email protected] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Of course... I'm becoming very familiar with jquery now lol. Still kind of have the same problem though, I guess there will just have to be another function for every form? Gross..
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | ||
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Ok I have like 20 jquery.com pages open trying to figure out how to do this but none of them work, lets say I have a few of these:
Quote:
I think the closest I've came is: Quote:
|
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
I can get the value of a <select> just fine, but since I have many of them stored into an array it's made this a lot more difficult.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
LOL I think I finally stumped everyone. I did find a solution though:
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |