Visualizzazione dei risultati da 1 a 3 su 3

Discussione: convalida form

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    507

    convalida form

    devo effettuare la convalida di iun form prima di poterlo inviare

    ho provato in mille modi diversi ma non ne funziona uno!!!!
    tra i tanti uno è questo:

    [CODE]function validate(){
    document.getElementById('Submit').disabled='disabl ed';
    if (document.getElementById('nome').value==""){
    alert ("Errore: compilare il campo NOME");
    document.getElementById('Submit').disabled = false;
    return false;
    }
    else if (document.getElementById('cognome').value==""){
    alert ("Errore: compilare il campo COGNOME");
    document.getElementById('Submit').disabled = false;
    return false;
    }
    else if (document.getElementById('eta').value==""){
    alert ("Errore: compilare il campo ETA");
    document.getElementById('Submit').disabled = false;
    return false;
    }
    else if (document.getElementById('cellulare').value==""){
    alert ("Errore: compilare il campo CELLULARE");
    document.getElementById('Submit').disabled = false;
    return false;
    }
    else if (document.getElementById('professione').value=="") {
    alert ("Errore: compilare il campo PROFESSIONE");
    document.getElementById('Submit').disabled = false;
    return false;
    }
    else if (document.form1.email.indexOf("@")==(-1) || email.indexOf(".")==(-1)) {
    alert("Inserisci un indirizzo e-mail valido");
    document.getElementById('Submit').disabled = false;
    return.false;
    }
    else if (document.getElementById('citta').value==""){
    alert ("Errore: compilare il campo CITTA");
    document.getElementById('Submit').disabled = false;
    return false;
    }
    else if (document.form1.categoria1.checked==false || document.form1.categoria2.checked==false ||){
    alert ("Errore: compilare il campo CATEGORIA DI INTERESSE");
    document.getElementById('Submit').disabled = false;
    return false;
    }
    return true;
    }

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    507
    up!

    nessuno sa dirmi qualcosa?

  3. #3
    forse così:

    function validate(theform) {
    if (theform. NOME.value==""){alert("Errore: compilare il campo NOME");return false;}

    else{if (theform.COGNOME.value=="" .....
    );return false;}}}

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.