JS textarea validation

by "Michael Gerholdt" <gerholdt(at)fredonia.edu>

 Date:  Wed, 25 Oct 2000 14:29:10 -0400
 To:  "hwg-languages" <hwg-languages(at)hwg.org>
  todo: View Thread, Original
Hi,

Is there something special about text areas in JavaScript regarding
validation?

This code works for <input ...> but not <textarea ...> though identical in
every other way.

"title" is input area - no problem. "description" is textarea and the script
ignores it.

help!

thanks,
Michael Gerholdt


function FrontPage_Form1_Validator(theForm)
{

  if (theForm.title.value == "")
  {
    alert("Please enter a value for the \"Title\" field.");
    theForm.title.focus();
    return (false);
  }

  if (theForm.title.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Title\" field.");
    theForm.title.focus();
    return (false);
  }

if (theForm.description.value == "")
  {
    alert("Please enter a value for the description field.");
    theForm.description.focus();
    return (false);
  }

 if (theForm.description.value.length < 1)

  {
    alert("Please enter at least 1 characters in the description field.");
    theForm.description.focus();
    return (false);
  }

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA