Link to home
Start Free TrialLog in
Avatar of JuniorBee
JuniorBeeFlag for United States of America

asked on

Compare 2 fields before submitting

How can I compare two fields to be sure they are the same onclick?  These are password fields and I did not want to have to submit the form to compare them if I can do it this way instead.

=)
SOLUTION
Avatar of BogoJoker
BogoJoker

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JuniorBee

ASKER

ahhh I see. Good point.  I think I will just check it using ASP since I just made a function to check that the username is not already used.  Good to know.  I have other stuff I should probably convert to ASP as well.

For my info, how do I completely disable the javascript in my browser (IE6) so that I can test any security holes in my code.  That would be helpful too!  Then I can see what needs to be in ASP and what's OK to leave in Javascript.
Avatar of danrosenthal
danrosenthal

The best approach would be to use both forms of validation: Server-side and Client-side. Client-side validation usually makes the site easier for your users.

I would recommend using Server-side validation 100% of the time (since it cannot be turned off like Client-side validation can) and adding Client-side validation (javascript) where you both think it is appropriate and have the time desire and code it.

-Dan
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Anybody got any client side pw validation script?  One for onclick?
Ack, you musta hit sumbit just before me eh?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yep :)
So, is that the kind of code you were looking for?
Looks good dan.  Also it is intuitive, by checking two conditions, if the first is blank, (no need to check the second given that your second check is), if the two are equal or unequal.

Joe P
Thanks a bunch!  I awarded the points according to the question I asked although it was all so very helpful!!!