This is a discussion on "Form with confirm password field" within the JavaScript Forum section. This forum, and the thread "Form with confirm password field are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Form with confirm password field
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Form with confirm password field
Hi Folks,
Could some one tell me if this is possible and how? I have user registration form where "password" and "confirm password" field exist. I want when user enter "confirm password" filed - if this does not match with the "password" field , it will give an error message right there before submitting the form and before going furthre any field. Many many thanks in advance. |
|
|
|
|||
|
Re: Form with confirm password field
You could do the validation in scripting language as well! What scripting language are you using? ASP, PHP...?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|||
|
Re: Form with confirm password field
Add a code like this to your page.
Obviously you change "pass" of "[0].pass.value" to whatever your input field is called. Same for confPass.
|
|
|||
|
Re: Form with confirm password field
Which is better? Doing it (validation) the Javascript way, or the Server Side Scripting way?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|||
|
Re: Form with confirm password field
Well.........
Javascript saves on server requests being used, hence saving bandwidth. It's also quicker and has no page refreshes. JS can be turned off though, or injected or stopped in many ways, so I guess it depends on the situation. In this case he wants a instant response before the form is sent so JS is the way to go. |
|
|||
|
Re: Form with confirm password field
Cristal clear Blake! If the js was disabled, that is what he must put in mind...
If he is using SSS, no need to worry...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Last edited by Monie; Dec 8th, 2007 at 00:34. |
|
|||
|
Re: Form with confirm password field
Thanks guys! It works fine but only one little buz! After password do not match error box comes up and you click ok the tab or curson goes to next form input box or filed , how can you let it stay in the password reconfirm filed.
One more thing. I have a signup page whose link http://www.bangladeshilivingabroad.com/111/signup.html if you check this link with Netscape, If you select from the drop down option I get a quick blink and it only happens in Netscape. I was testing netscape 7.2. ANY IDEA Guys!!!!!!11 |
|
||||
|
Re: Form with confirm password field
need to focus it back...
To answer your question on validation Client side or Server Side? Depends on what it is. Password matching is too important to trust JavaScript with, so you need to validate it both with Javascript and a server side language. Someone says "Why use Javascript if your going to validate it with a SSL?" Well the answer is people who have JS enabled will enjoy the benefits of a quick site, while people without will have to reload the page.
Last Blog Entry: Happy Holidays - A Non Offensive way to say Merry Christmas? WRONG! (Dec 11th, 2007)
|
|
|||
|
Re: Form with confirm password field
Thanks Justin. I agree with you. I did actually server end also so I have both in my page. But Any idea about the problem i mentioned!
|
|
||||
|
Re: Form with confirm password field
it's just a focus method...
Here's a snippett of code. email.focus() is what your looking for
Last Blog Entry: Happy Holidays - A Non Offensive way to say Merry Christmas? WRONG! (Dec 11th, 2007)
|
|
|||
|
Re: Form with confirm password field
Hi Justin,
I have no problem with the email issue. What i wanted is that when u input password and reconfirm that it both does not match it gives errror message, after clicking ok cursor should stay at the reconfirm password filed but it is right now goes to next field. how can you let it stay in the password reconfirm filed. One more thing. I have a signup page whose link http://www.bangladeshilivingabroad.com/111/signup.html if you check this link with Netscape, If you select from the drop down option I get a quick blink and it only happens in Netscape. I was testing netscape 7.2. ANY IDEA Guys! |
|
||||
|
Re: Form with confirm password field
The above code is the answer to your question about the password field. The code was originally designed for a field named Email, but you can just as easily replace it with password. Seeing as I was linking code I figured it best to leave it as is in order to give W3Schools their proper quote.
As far as Netscape goes.. I don't have netscape installed and I won't be installing it anytime soon. So not sure what the blinking effect is.
Last Blog Entry: Happy Holidays - A Non Offensive way to say Merry Christmas? WRONG! (Dec 11th, 2007)
|
|
|||
|
Re: Form with confirm password field
Basically you take my old code and add this extra bit in bold:
Remember to change "confPass" to whatever your text input is called. |
|
|||
|
Re: Form with confirm password field
No! still didn't work. Here is my code I am using
|
|
|||
|
Re: Form with confirm password field
Hi Blake121,
Never mind I got it working now. I had to use
Now one more things comes to my mind.. how can you get that password2 filed highlighted. |
|
|||
|
Re: Form with confirm password field
Never mind guys, I got that ok now. Thanks for all the help.
|
|
|||
|
Re: Form with confirm password field
Glad you got it sorted
You can mark this thread solved if you like. |
|
|||
|
Re: [SOLVED] Form with confirm password field
Hi,
I am back again with little problem. It is working fine with IE but not in Netscape or firefox. Here is the code..
|
|
||||
|
Re: [SOLVED] Form with confirm password field
Try fixing the case mismatches and declaring you variables to avoid the confusion that some broswers may encounter
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| multiple form field calculation | thenamenoonehastaken | JavaScript Forum | 2 | Feb 21st, 2008 22:32 |
| Number validation in form field | Matc | JavaScript Forum | 2 | May 26th, 2006 15:05 |
| adding a field input to the subject in a form | goatsalad | PHP Forum | 1 | Feb 3rd, 2006 14:49 |
| Newbie: changing the value of a field on form | d9085 | Databases | 1 | Dec 12th, 2005 18:08 |
| Add a form field | csa | Web Page Design | 8 | Nov 23rd, 2005 20:33 |