simple validate form

Giganews Newsgroups
Subject: simple validate form
Posted by:  Mattia (mattia…@libero.it)
Date: Tue, 22 Jul 2003

Hi!
I would like to validate a fiels in a form, but the code I wrote doesn't
seem to work:

HTML:

<form name="formNome" method="post" action="/index.php" onSubmit="return
check_profilo_cambia( this )">
<input type="text" name="nome" value="Mattia"><br>
</form>

script:
function check_profilo_cambia( myForm )
{
    if( myForm.nome.value.length < 2 )
    {
        alert( "il nome deve essere composto da un minimo di 2 caratteri");
        return false;
    }
[...]

the js debugger keep saying that myForm.nome has no properties.

Thanks

--
  Mattia

Replies