Solved

Textarea validation

Posted on 2004-03-30
6
282 Views
Last Modified: 2010-05-18
hi...i can't seem to validate textarea..

function TextAreaRequired(Form, Field)
{
  var length = eval("document." + Form + "." + Field    + ".value.length");
if (length == 0)
      {return false;}
      else
      {return true;}
}
if (!TextAreaRequired(FormName, 'Work_Scope'))
{
alert("You must enter your job scope");
return false;
}
</script>


<textarea name="Work_Scope" rows="5" cols="44" wrap="virtual">[Enter your job title, scope etc. Max. 255 characters]</textarea></td>

What is wrong with this? Thanks!
0
Comment
Question by:knighto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10720460
<form name="FormName">
<textarea name="Work_Scope" rows="5" cols="44" wrap="virtual">[Enter your job title, scope etc. Max. 255 characters]
</textarea>
</form>

<script>

function TextAreaRequired(Form, Field)
{
  var length = eval("document." + Form + "." + Field    + ".value");
  if (length == 0)
      {return false;}
     else
      {return true;}
}
if (!TextAreaRequired("FormName", 'Work_Scope'))
{
alert("You must enter your job scope");
}
</script>
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10720465

first of all FormName is not a variable.......
and then you are using the formname variable before the form is created...
0
 

Author Comment

by:knighto
ID: 10720634

er...there is an error when i click on submit....

Error:'document.FormName.Work_Scope' is null or not an object

Code:0

there is also a page is not displayed error.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10720743

Check the variable name....
Post the code... I will take a look
0
 

Author Comment

by:knighto
ID: 10720971
<script>
function TextAreaRequired(Form, Field)
{
  var length = eval("document." + Form + "." + Field    + ".value");
  if (length == 0)
      {return false;}
     else
      {return true;}
}
if (!TextAreaRequired(FormName,"Work_Scope"))
{
alert("You must enter your job scope");
}
</script>

<cfform name="FormName" action="Student_RegistrationAction3.cfm" method="post">

<tr class="normal">
      <td colspan="2">
        <textarea name="Work_Scope" rows="5" cols="44" wrap="virtual">[Enter your job title, scope etc. Max. 255 characters]</textarea></td>
            </tr>
                <tr>
        <td align="right" colspan="2">
      <input type="reset" value="Clear">
      <input type="submit" value="Add">
      </td>
      </tr>
0
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 30 total points
ID: 10721076
<cfform name="FormName" action="Student_RegistrationAction3.cfm" method="post">

should be

<form name="FormName" action="Student_RegistrationAction3.cfm" method="post">
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Xsl Nested Loop 4 35
How to deal with "Consider using Code First Migrations to update the database" ? 7 459
MVC and Angular 2 129
Unexpected End of File 11 81
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question