simple validate form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mattia

    simple validate form

    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="retur n
    check_profilo_c ambia( this )">
    <input type="text" name="nome" value="Mattia"> <br>
    </form>

    script:
    function check_profilo_c ambia( myForm )
    {
    if( myForm.nome.val ue.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

  • Philip Ronan

    #2
    Re: simple validate form

    On 03.7.22 10:23 PM, Mattia wrote:
    [color=blue]
    > 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="retur n
    > check_profilo_c ambia( this )">
    > <input type="text" name="nome" value="Mattia"> <br>
    > </form>[/color]
    .... etc...

    Maybe the problem is with name="nome"

    This is likely to clash with another attribute of the "form" object.

    Try changing it to name="fullname" or something.

    Phil

    --
    Philip Ronan
    phil.ronanzzz@v irgin.net
    (Please remove the "z"s if replying by email)


    Comment

    Working...