RE : validate 2 password fields
| From: | Neil Smith [MVP, Digital media] | Date: | Wed, 30 Jun 2004 08:53:01 +0000 |
| Subject: | RE : validate 2 password fields | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35045@lists.php.net to get a copy of this message | ||
Sorry, my typo, the else line should have read (note the missing brace)
return true;
} else {
alert("Passwords did not match");
Please note you need to turn on error reporting for scripts in IE or your chosen browser - doing so would have told you the line which had the syntax error. Developing websites with error reporting turned off is a terribly bad idea ;-)
Cheers - Neil
At 23:11 29/06/2004 -0400, Vincent Jordan wrote:
I have the following code and it is not working. it will pass the info along. hwew is a copy of the entire code:. <?php ?> <script> function Validate() { if (document.UserAddNew.username.value == '') { alert('Warranty Database:\nPlease Enter a Username\!'); document.UserAddNew.username.select(); return false; } if (document.UserAddNew.password.value == '') { alert('Warranty Database:\nPlease Enter a Password\!'); document.UserAddNew.password.select(); return false; } } function checkpasswords() { df=document.forms['UserAddNew']; if (df['password'].value==df['password2'].value) { // Passwords matched, clear password2, allow form to submit df['password2'].value=''; return true; else { alert('Passwords did not match'); return false; } } </script> <form method='post' action='' name='UserAddNew' onSubmit='return checkpasswords()'> Username : <INPUT TYPE='TEXT' name='username' title='username' id='username'><br> Password : <INPUT TYPE='TEXT' name='password' title='password' id='password'><br> Re Type Password: <INPUT TYPE='TEXT' name='password2' title='password2' id='password2'><br> Department: <SELECT name='department' title='department' id='department'> <OPTION value='Managment'>Managment</OPTION> <OPTION value='Sales'>Sales</OPTION> <OPTION value='Tech Support'>Tech Support</OPTION> <OPTION value='Returns'>Returns</OPTION> <OPTION value='Other'>Other</OPTION></SELECT><br> <input type=submit name=submit value='Add'> <input type=reset name=reset value='Reset' onClick="if (confirm('Warranty Database:\nAre you sure you want to reset the form\?'));"> </FORM> ----- Original Message ----- From: "Neil Smith [MVP, Digital media]" <php@comatose.freeserve.co.uk> To: <vjordan@extendedpop.com> Cc: <php-db@lists.php.net> Sent: Tuesday, June 29, 2004 6:25 AM Subject: [SPAM] RE : validate 2 password fields Attach onsubmit="return checkpasswords()" to your form tag..... function checkpasswords() {======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.df=document.forms["DisplayUser"]; if (df["password1"].value==df["password2"].value) { // Passwords matched, clear password2, allow form to submit df["password2"].value=""; return true; else { alert("Passwords did not match"); return false; }} Cheers - NeillikeMessage-ID: <002c01c45ca9$cffcdbe0$fe00000a@extendeddwc7l0> From: "Vincent Jordan" <vjordan@extendedpop.com> To: <php-db@lists.php.net> Date: Sun, 27 Jun 2004 20:49:47 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative;boundary="----=_NextPart_000_0029_01C45C88.48576050"Subject: 2 requests: validate 2 password fields as equal and rewrite data Could someone instruct me or point me in the right direction. I wouldto have a <input type=password name=password> <input type=password name=password2> when submit it will check to se if password and password2 are = ( i do not want password2 to end up in POST on submit.)======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.