Java Control Validation on ASP.NET
-
I have been told by many people that javascript is the way forward for validating the amount of characters in a field, however i have tried several snippets of java code (that work in an html document) and i cant seem to get them to function alongside my aspx page. this is proving to be quite a pain as it is putting the breaks on my progression, i need to learn javascript and am doing so bit by bit, but more importantly i need practice with asp.net coding. this is why i am creating an application, but this is a necessary part of it. below is the link to the code i have tried.. i have tried substituting the names in all field and cant really see why it wouldnt work. any help, or code, or anything really would be much appreciate. and if it is easier by viewing my code let me know and i will post it.... http://javascript.internet.com/forms/val-pass.html many thanks, John Kinsella
John Michael Kinsella kinsellajohn@hotmail.com
-
I have been told by many people that javascript is the way forward for validating the amount of characters in a field, however i have tried several snippets of java code (that work in an html document) and i cant seem to get them to function alongside my aspx page. this is proving to be quite a pain as it is putting the breaks on my progression, i need to learn javascript and am doing so bit by bit, but more importantly i need practice with asp.net coding. this is why i am creating an application, but this is a necessary part of it. below is the link to the code i have tried.. i have tried substituting the names in all field and cant really see why it wouldnt work. any help, or code, or anything really would be much appreciate. and if it is easier by viewing my code let me know and i will post it.... http://javascript.internet.com/forms/val-pass.html many thanks, John Kinsella
John Michael Kinsella kinsellajohn@hotmail.com
Can you post the Javascipt code ?
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Can you post the Javascipt code ?
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
<!-- Original: Russ Swift (rswift220@yahoo.com) --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin function validatePwd() { var invalid = " "; // Invalid character is a space var minLength = 6; // Minimum length var pw1 = document.myForm.password.value; var pw2 = document.myForm.password2.value; // check for a value in both fields. if (pw1 == '' || pw2 == '') { alert('Please enter your password twice.'); return false; } // check for minimum length if (document.myForm.password.value.length < minLength) { alert('Your password must be at least ' + minLength + ' characters long. Try again.'); return false; } // check for spaces if (document.myForm.password.value.indexOf(invalid) > -1) { alert("Sorry, spaces are not allowed."); return false; } else { if (pw1 != pw2) { alert ("You did not enter the same new password twice. Please re-enter your password."); return false; } else { alert('Nice job.'); return true; } } } // End -->
Enter your password twice.
(At least 6 characters, 12 characters max, and spaces are not allowed.)Password:
Verify password:Free JavaScripts provided
by The JavaScript SourceWill the asp code help aswell???
John Michael Kinsella kinsellajohn@hotmail.com