GreatPlains
asked on
Creating a Maxlength for Multiple Textareas
I have a couple text boxes in a form. They both require a different amount of lengths. It reads the one javascript to check it, but not for the second textarea. How do I get both of them to work.
Here is my Code:
<script language="javascript" type="text/javascript">
<!--
function validate() {
maxlength=1000;
if(document.myForm.ldesc.v alue.lengt h>=maxleng th) {
alert('Your Long Description must be 1000 characters or less');
document.myForm.ldesc.focu s();
return false;
} else {
return true;
}
}
function validate1() {
maxlength=250;
if(document.myForm.bdesc.v alue.lengt h>=maxleng th) {
alert('Your Brief Description must be 250 characters or less');
document.myForm.bdesc.focu s();
return false;
} else {
return true;
}
}
//-->
</script>
Here is the form Action:
<cfform name="myForm" action="submitMod2.cfm" method="post" enctype="multipart/form-da ta" onsubmit="return validate(); return validate1();" >
Here is my Code:
<script language="javascript" type="text/javascript">
<!--
function validate() {
maxlength=1000;
if(document.myForm.ldesc.v
alert('Your Long Description must be 1000 characters or less');
document.myForm.ldesc.focu
return false;
} else {
return true;
}
}
function validate1() {
maxlength=250;
if(document.myForm.bdesc.v
alert('Your Brief Description must be 250 characters or less');
document.myForm.bdesc.focu
return false;
} else {
return true;
}
}
//-->
</script>
Here is the form Action:
<cfform name="myForm" action="submitMod2.cfm" method="post" enctype="multipart/form-da
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks