View Full Version : Form validation javascript
zoobie
June 12th, 2002, 02:09
It's amazing how much you forget in 3 months.
Anyway, I need a javascript that restricts the user from filling out multiple email addresses in a form's textbox and restricts them to only one.
<input type=text name=to size=20 value=Your email address>
Thanks :classic2:
nag
June 12th, 2002, 03:43
Use form object of javascript in a way like
form.fieldname.value
and use it in IF statement Actually I never used it so i do not know exact syntax anyhow in your case it would be
if(form.to.value==(condition)){
then do this
}
like this "to" is the name of field and "value" is the value typed in the field......
zoobie
June 12th, 2002, 19:58
Why isn't this working with a submit button?
<script>
function oneaddress(){
var ary = document.form.to.value.split("@");
if (ary.length > 2) {
alert("Error!");
return true;
}
</script>
Thanks :rolleyes:
w3exit
June 22nd, 2002, 13:03
try a free script at javascriptkit.com
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.