| Author |
Checking value of one textfield matching the other
|
vanan saravanan
Ranch Hand
Joined: Jun 02, 2006
Posts: 95
|
|
I'm trying to come up with a password change function. This is how it should work 1 textfield : enter new passowrd 2 textfield : enter same password If the value from both the textfield match, then update the database. I do know how to do the updating and retriving part. Need help on how to compare both textfields and to provide a pop up if they dont match.
|
 |
ankur rathi
Ranch Hand
Joined: Oct 11, 2004
Posts: 3829
|
|
Originally posted by vanan saravanan: I'm trying to come up with a password change function. This is how it should work 1 textfield : enter new passowrd 2 textfield : enter same password If the value from both the textfield match, then update the database. I do know how to do the updating and retriving part. Need help on how to compare both textfields and to provide a pop up if they dont match.
I think, Javascript would be better for this kind of validation but do it on server side also. Getting value of textfield in JS: var value = document.getElementById("id_of_textfield").value; Now it's your job.
|
 |
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3652
|
|
|
The general guideline is, always use javascript to validate really simple logic but also always validate any input to the middle tier. This may mean validation gets checked at 3 levels (javascript/servlet/database) but its not pointless since your inputs may not come from the same places all the time and the systems need to protect themselves and their data.
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
Marko Debac
Ranch Hand
Joined: Aug 21, 2006
Posts: 121
|
|
Hello, Scott, what do you meen by servlet validation? Cheers
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Marko Debac: Hello, Scott, what do you meen by servlet validation? Cheers
What he means is that it's important to validate input on the servers side (even if you're also doing so with Javascript on the client).
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: Checking value of one textfield matching the other
|
|
|