Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Form Iscrizione: Funchia solo con IE

    Questo sorgente mi chiama l'action soltanto con IE.
    Scrivo il sorgente:
    ------------------------------------------------------------------------
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script language="VBScript">
    function chk_car(vrchk)
    vrchk=Replace(vrchk,"'","")
    vrchk=Replace(vrchk,"""","")
    chk_car=vrchk
    end function
    </script>
    <script language="JavaScript">
    function invia() {
    ok=1;
    if (document.forms[0].cognome.value=="") {
    ok=0;
    }
    if (document.forms[0].nome.value=="") {
    ok=0;
    }
    if (document.forms[0].email.value=="") {
    ok=0;
    }
    if (document.forms[0].nascita.value=="") {
    ok=0;
    }
    if (document.forms[0].alias.value=="") {
    ok=0;
    }
    if (document.forms[0].password.value=="") {
    ok=0;
    }

    if (ok==1) {
    if (document.forms[0].password.value!=document.forms[0].password1.value) {
    ok=2;
    }
    }

    if (ok==0) {
    alert("Complilare tutti i campi obbligatori");
    }

    if (ok==2) {
    alert("La password non è stata scritta correttamente");
    }

    // correzone cratteri non validi
    document.forms[0].cognome.value=chk_car(document.forms[0].cognome.value);
    document.forms[0].nome.value=chk_car(document.forms[0].nome.value);
    document.forms[0].sesso.value=chk_car(document.forms[0].sesso.value);
    document.forms[0].email.value=chk_car(document.forms[0].email.value);
    document.forms[0].citta.value=chk_car(document.forms[0].citta.value);
    document.forms[0].stato.value=chk_car(document.forms[0].stato.value);
    document.forms[0].nascita.value=chk_car(document.forms[0].nascita.value);
    document.forms[0].professione.value=chk_car(document.forms[0].professione.value);
    document.forms[0].sito.value=chk_car(document.forms[0].sito.value);
    document.forms[0].alias.value=chk_car(document.forms[0].alias.value);
    document.forms[0].password.value=chk_car(document.forms[0].password.value);
    document.forms[0].password1.value=chk_car(document.forms[0].password1.value);
    // fine correzione

    if (ok==1) {
    document.forms[0].submit();
    }
    }
    </script>

    <link href="/ccs/Frame.css" rel="stylesheet" type="text/css">
    </head>

    <body>
    <h4 align="center" class="Titolo">Iscrizione</h4>
    <h5 align="center" class="Testo"><font color="#FF0000"">i dati in rosso sono obbligatori</font>
    </h5>
    <p class="Testo">
    <center>
    </center>
    <form action="MyPage.asp" method="post">
    <table align="center">
    <tr>
    <td align="right"><font color="#FF0000">Nome</font></td>
    <td><input name="nome" type="text" size="20" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right"><font color="#FF0000">Cognome</font></td>
    <td><input name="cognome" type="text" size="20" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right">Sesso</td>
    <td><input name="sesso" type="text" size="1" maxlength="1" /></td>
    </tr>
    <tr>
    <td align="right"><font color="#FF0000">Email</font></td>
    <td><input name="email" type="text" size="30" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right">Città</td>
    <td><input name="citta" type="text" size="20" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right">Stato</td>
    <td><input name="stato" type="text" size="20" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right"><font color="#FF0000">Anno di nascita</font></td>
    <td><input name="nascita" type="text" size="4" maxlength="4" /> es. 1980</td>
    </tr>
    <tr>
    <td align="right">Professione</td>
    <td><input name="professione" type="text" value="" size="40" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right">Sito</td>
    <td><input name="sito" type="text" value="http://" size="40" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right"><font color="#FF0000">Alias</font></td>
    <td><input name="alias" type="text" value="" size="40" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right"><font color="#FF0000">Password</font></td>
    <td><input name="password" type="password" value="" size="40" maxlength="50" /></td>
    </tr>
    <tr>
    <td align="right"><font color="#FF0000">Ripeti Password</font></td>
    <td><input name="password1" type="password" value="" size="40" maxlength="50" /></td>
    </tr>
    <tr><td></td>
    <td align="center"><input name="" type="button" value="Iscriviti" onclick='invia()'/>

    <input name="" type="reset" value="Cancella" /></td>
    </tr>
    </table>
    </form>

    </body></html>
    --------------------------------------------------------------------

    Non riesco a trovare l'errore
    Io nella vita ho visto cose che voi astemi neanche potete immaginare.

  2. #2
    Mamma saura che quantità assurda di codice inutile!

    Ad un'occhiata generale, credo che il problema risieda nel puntamento agli elementi dotati di id. Dovresti sostituire, ad esempio,

    codice:
    document.forms[0].cognome.value==""
    con il codice standard

    codice:
    document.getElementById('cognome').value == ""
    Sappi che ci sarebbe da mettere pesantemente mano alla struttura di markup del documento. Prova comunque intanto a fare le modifiche che ti ho proposto e vediamo se era quello il problema.

  3. #3
    no, questi controlli passano senza problemi.

    E' quando arriva al submit che va solo con IE
    Io nella vita ho visto cose che voi astemi neanche potete immaginare.

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 © 2026 vBulletin Solutions, Inc. All rights reserved.