Solved

Textarea validation

Posted on 2004-03-30
6
277 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
  • 4
  • 2
6 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
Comment Utility
<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
Comment Utility

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
Comment Utility

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 12

Expert Comment

by:venkateshwarr
Comment Utility

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

Author Comment

by:knighto
Comment Utility
<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
Comment Utility
<cfform name="FormName" action="Student_RegistrationAction3.cfm" method="post">

should be

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now