[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Textarea validation

Posted on 2004-03-30
6
Medium Priority
?
287 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
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 120 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

864 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