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

    problemi con validazione campo email

    Ciao a tutti
    sono nuovo sul forum e prima di postare il il mio problema ho cercato se prima di me qualcuno lo aveva posto.

    Ho modificato la pagina che mi aveva creato un mio amico che è tornato in Sicilia ma non so' più come rintracciarlo. Ho voluto aggiungere un altro campo per validare la mail ma non funziona.
    qualcuno può aiutarmi?? Grazie di tutto


    <%
    '============= SETTAGGIO del tipo di template =================
    'i valori di session("tipo_template") possono essere:
    ' - menusx (con menù a sinistra e cella contenuto per la restante parte)
    ' - menudx (con menù a destra e cella contenuto per la restante parte)
    ' - no_menu (senza menù)
    ' - menusxdx (con menù sia a sinistra sia a destra)

    session("tipo_template")="menusx"
    '================================================= =============
    %>

    <script language="JavaScript">
    <!--
    function ErrEmail() {
    if (document.frmEdit.txtEmail.value.indexOf("@") == -1 | document.frmEdit.txtEmail.value.indexOf(".") == -1) {
    return true;
    }else{
    return false;
    }
    }

    function ErrEmail_() {
    if (document.frmEdit.txtEmail_1.value != document.frmEdit.txtEmail.value -1){
    return true;
    }else {
    return false;
    }
    }

    function checkForm(){
    if (document.frmEdit.txtNome.value=="" | document.frmEdit.txtCognome.value=="" | document.frmEdit.txtEmail.value=="" | document.frmEdit.txtEmail_1.value=="" | document.frmEdit.txtUsername.value=="" | document.frmEdit.txtPassword.value=="" | document.frmEdit.txtDomanda.value=="" | document.frmEdit.txtRisposta.value==""){
    alert ("Per poterti registrare, devi \ncompilare tutti i campi!");
    document.frmEdit.txtNome.focus();
    return false;
    }
    if (ErrEmail()){
    document.frmEdit.txtEmail.focus();
    alert ("Il campo email non è \n compilato correttamente!");
    return false;
    }else{
    return true;
    }
    if (ErrEmail_()){
    document.frmEdit.txtEmail_1.focus();
    alert ("Prego vericare la mail");;
    return false;
    }else{
    return true;
    }
    }

    // -->
    </script>

    <div id="Form" align="center">


    <form id="frmEdit" name="frmEdit" action="gestione_utente.asp" METHOD="POST" onsubmit="return checkForm()">
    <input type="hidden" name="azione" value="registrazione">
    <TABLE BORDER=0 BGCOLOR=#ffffff CELLSPACING=0 id=section>
    <tr>
    <th align=center id=sectionheader colspan=4>Registrazione nuovo utente...</th>
    </tr>
    <tr>
    <th align=right>Nome</th>
    <td><input ID="txtNome" name="txtNome" size="20" maxlength="50"></td>
    <th align=right>Cognome</th>
    <td><input ID="txtCognome" name="txtCognome" size="20" maxlength="50"></td>
    </tr>
    <tr>
    <td colspan="3"></td>
    </tr>
    <tr>
    <th align=right>E-mail</th>
    <td><input ID="txtEmail" name="txtEmail" size="20" maxlength="50"></td>
    <th align=right>riscrivi mail</th>
    <td><input ID="txtEmail_1" name="txtEmail_x" size="20" maxlength="50"></td>
    </tr>
    <tr>
    <td colspan="4"></td>
    </tr>
    <tr>
    <th align=right>Username</th>
    <td><input ID="txtUsername" name="txtUsername" size="20" maxlength="20"></td>
    <th align=right>Password</th>
    <td><input type="password" ID="txtPassword" name="txtPassword" size="20" maxlength="20"></td>
    </tr>
    <tr>
    <td colspan="4"></td>
    </tr>
    <tr>
    <td align=left colspan="4">Scrivi una domanda. Questa ti verrà posta se dimenticherai la tua password. Se la risposta coinciderà_con quella che indichi sotto, la password ti
    verrà inviata automaticamente dal sistema.</td>
    </tr>
    <tr>
    <td align=left>Domanda... (ad es. Come si chiama il mio cane?)</td>
    <td colspan="3" valign="bottom"><input ID="txtDomanda" name="txtDomanda" size="20" maxlength="50"> (max 50 caratteri)</td>
    </tr>
    <tr><td>
    </td></tr>
    <tr>
    <th align=right>Risposta...</th>
    <td colspan="3"><input ID="txtRisposta" name="txtRisposta" size="20" maxlength="30"> (max 30 caratteri)</td>
    </tr>
    <tr>
    <td colspan=4 align=center>

    <input type=submit value="r e g i s t r a t i" ID="cmdConf" name="cmdConf" >&nbsp&nbsp&nbsp<input type="button" name="btnAnnulla" value="Annulla" onclick="javascript: location.href = 'index.asp';" ID="Button1">



    </td>
    </tr>
    </table>
    </form>
    </div>




  2. #2
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    codice:
    function checkForm(){
    if (document.frmEdit.txtNome.value=="" || document.frmEdit.txtCognome.value=="" || document.frmEdit.txtEmail.value=="" || document.frmEdit.txtEmail_1.value=="" || document.frmEdit.txtUsername.value=="" || document.frmEdit.txtPassword.value=="" | |document.frmEdit.txtDomanda.value=="" || document.frmEdit.txtRisposta.value==""){
    alert ("Per poterti registrare, devi \ncompilare tutti i campi!");
    document.frmEdit.txtNome.focus();
    return false;
    }
    if (document.frmEdit.txtEmail.value.indexOf("@") == -1 | | document.frmEdit.txtEmail.value.indexOf(".") == -1) {
    alert ("Il campo email non è \n compilato correttamente!");
    return false;
    }
    }
    e benvenuto.
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  3. #3

    problemi con validazione campo email

    Ciao Andrea, grazie del benvenuto ma, soprattutto, grazie per aver postato al mio problema...
    Sicuramente il testo del titolo ti ha tratto in inganno in quanto intendevo la validazione dei due campi e-mail per verificare se sono uguali. il mio problema è che non saprei dove e come impostare il codice - ho provato in vari modi ma, non avendolo fatto io, e soprattutto non avendo mai programmato in javascript - così la modifica non mi funziona e non registra i dati nel database.
    Avrei così la necessità della compilazione e la sua giusta sequenza
    qui di seguito posto l'originale che funziona senza le mie modifiche :
    (aggiunta di un'altro campo e-mail per verificare che sia uguale alla prima)
    Grazie mille ancora


    <%
    '============= SETTAGGIO del tipo di template =================
    'i valori di session("tipo_template") possono essere:
    ' - menusx (con menù a sinistra e cella contenuto per la restante parte)
    ' - menudx (con menù a destra e cella contenuto per la restante parte)
    ' - no_menu (senza menù)
    ' - menusxdx (con menù sia a sinistra sia a destra)

    session("tipo_template")="menusx"
    '================================================= =============
    %>

    <script language="JavaScript">
    <!--
    function ErrEmail() {
    if (document.frmEdit.txtEmail.value.indexOf("@") == -1 | document.frmEdit.txtEmail.value.indexOf(".") == -1) {
    return true;
    }else{
    return false;
    }
    }

    function checkForm(){
    if (document.frmEdit.txtNome.value=="" | document.frmEdit.txtCognome.value=="" | document.frmEdit.txtEmail.value=="" | document.frmEdit.txtUsername.value=="" | document.frmEdit.txtPassword.value=="" | document.frmEdit.txtDomanda.value=="" | document.frmEdit.txtRisposta.value==""){
    alert ("Per poterti registrare, devi \ncompilare tutti i campi!");
    document.frmEdit.txtNome.focus();
    return false;
    }
    if (ErrEmail()){
    document.frmEdit.txtEmail.focus();
    alert (" Il campo email non è \n compilato correttamente!");
    return false;
    }else{
    return true;
    }
    }

    // -->
    </script>

    <div id="Form" align="center">


    <form id="frmEdit" name="frmEdit" action="gestione_utente.asp" METHOD="POST" onsubmit="return checkForm()">
    <input type="hidden" name="azione" value="registrazione">
    <TABLE BORDER=0 BGCOLOR=#ffffff CELLSPACING=0 id=section>
    <tr>
    <th align=center id=sectionheader colspan=4>Registrazione nuovo utente...</th>
    </tr>
    <tr>
    <th align=right>Nome</th>
    <td><input ID="txtNome" name="txtNome" size="20" maxlength="50"></td>
    <th align=right>Cognome</th>
    <td><input ID="txtCognome" name="txtCognome" size="20" maxlength="50"></td>
    </tr>
    <tr>
    <th align=right>E-mail</th>
    <td colspan="3"><input ID="txtEmail" name="txtEmail" size="20" maxlength="50"></td>
    </tr>
    <tr>
    <td colspan="4"></td>
    </tr>
    <tr>
    <th align=right>Username</th>
    <td><input ID="txtUsername" name="txtUsername" size="20" maxlength="20"></td>
    <th align=right>Password</th>
    <td><input type="password" ID="txtPassword" name="txtPassword" size="20" maxlength="20"></td>
    </tr>
    <tr>
    <td colspan="4"></td>
    </tr>
    <tr>
    <td align=left colspan="4">Scrivi una domanda. Questa ti verrà posta se dimenticherai la tua password. Se la risposta coinciderà_con quella che indichi sotto, la password ti
    verrà inviata automaticamente dal sistema.</td>
    </tr>
    <tr>
    <td align=left>Domanda... (ad es. Come si chiama il mio cane?)</td>
    <td colspan="3" valign="bottom"><input ID="txtDomanda" name="txtDomanda" size="20" maxlength="50"> (max 50 caratteri)</td>
    </tr>
    <tr><td>
    </td></tr>
    <tr>
    <th align=right>Risposta...</th>
    <td colspan="3"><input ID="txtRisposta" name="txtRisposta" size="20" maxlength="30"> (max 30 caratteri)</td>
    </tr>
    <tr>
    <td colspan=4 align=center>

    <input type=submit value="r e g i s t r a t i" ID="cmdConf" name="cmdConf" >&nbsp&nbsp&nbsp<input type="button" name="btnAnnulla" value="Annulla" onclick="javascript: location.href = 'index.asp';" ID="Button1">



    </td>
    </tr>
    </table>
    </form>
    </div>




  4. #4
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    codice:
    function checkForm(){
    if (document.frmEdit.txtNome.value=="" || document.frmEdit.txtCognome.value=="" || document.frmEdit.txtEmail.value=="" || document.frmEdit.txtEmail_1.value=="" || document.frmEdit.txtUsername.value=="" || document.frmEdit.txtPassword.value=="" | |document.frmEdit.txtDomanda.value=="" || document.frmEdit.txtRisposta.value==""){
    alert ("Per poterti registrare, devi \ncompilare tutti i campi!");
    document.frmEdit.txtNome.focus();
    return false;
    }
    if (document.frmEdit.txtEmail.value.indexOf("@") == -1 | | document.frmEdit.txtEmail.value.indexOf(".") == -1) {
    alert ("Il campo email non è \n compilato correttamente!");
    return false;
    }else if (document.frmEdit.txtEmail.value != document.frmEdit.txtEmail_1.value) {
    alert ("La conferma email non è corretta!");
    document.frmEdit.txtEmail_1.focus();
    return false;
    }
    }
    e modifica questa riga
    <input ID="txtEmail_1" name="txtEmail_x" size="20" maxlength="50">
    con questa
    <input id="txtEmail_1" name="txtEmail_1" size="20" maxlength="50">
    In futuro posta il codice usando il tasto code
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  5. #5

    problemi con validazione doppio campo email

    Ciao Andrea, ho provato ad inserire il codice che mi hai suggerito, ma non funziona e, come a me, non va neppure a registrarlo nel DB....
    Purtroppo, non conoscendo questo linguaggio - ho solo programmato in Cobol, basic e clipper+db3 - vado a tentativi sul lavoro di quel ragazzo che ha fatto il programma.
    Ho fatto anche la prova di NON compilare il form e NON mi segnala l'errore previsto.
    Se può servirti a capire meglio il problema, ti linko la pagina del sito da cui parte.

    http://www.lebellezzeditalia.it/ospi...uovoutente.asp

    la pagina modifcata come da tuo gentile suggerimento è così:


    <%
    '============= SETTAGGIO del tipo di template =================
    'i valori di session("tipo_template") possono essere:
    ' - menusx (con menù a sinistra e cella contenuto per la restante parte)
    ' - menudx (con menù a destra e cella contenuto per la restante parte)
    ' - no_menu (senza menù)
    ' - menusxdx (con menù sia a sinistra sia a destra)

    session("tipo_template")="menusx"
    '================================================= =============
    %>

    <script language="JavaScript">
    <!--
    function ErrEmail() {
    if (document.frmEdit.txtEmail.value.indexOf("@") == -1 | document.frmEdit.txtEmail.value.indexOf(".") == -1) {
    return true;
    }else{
    return false;
    }
    }

    function checkForm(){
    if (document.frmEdit.txtNome.value=="" || document.frmEdit.txtCognome.value=="" || document.frmEdit.txtEmail.value=="" || document.frmEdit.txtEmail_1.value=="" || document.frmEdit.txtUsername.value=="" || document.frmEdit.txtPassword.value=="" | |document.frmEdit.txtDomanda.value=="" || document.frmEdit.txtRisposta.value==""){
    alert ("Per poterti registrare, devi \ncompilare tutti i campi!");
    document.frmEdit.txtNome.focus();
    return false;
    }
    if (document.frmEdit.txtEmail.value.indexOf("@") == -1 | | document.frmEdit.txtEmail.value.indexOf(".") == -1) {
    alert ("Il campo email non è \n compilato correttamente!");
    return false;
    }else if (document.frmEdit.txtEmail.value != document.frmEdit.txtEmail_1.value) {
    alert ("La conferma email non è corretta!");
    document.frmEdit.txtEmail_1.focus();
    return false;
    }
    }
    // -->
    </script>

    <div id="Form" align="center">


    <form id="frmEdit" name="frmEdit" action="gestione_utente.asp" METHOD="POST" onsubmit="return checkForm()">
    <input type="hidden" name="azione" value="registrazione">
    <TABLE BORDER=0 BGCOLOR=#ffffff CELLSPACING=0 id=section>
    <tr>
    <th align=center id=sectionheader colspan=4>Registrazione nuovo utente...</th>
    </tr>
    <tr>
    <th align=right>Nome</th>
    <td><input ID="txtNome" name="txtNome" size="20" maxlength="50"></td>
    <th align=right>Cognome</th>
    <td><input ID="txtCognome" name="txtCognome" size="20" maxlength="50"></td>
    </tr>
    <tr>
    <th align=right>E-mail</th>
    <td><input ID="txtEmail" name="txtEmail" size="20" maxlength="50"></td>
    <th align=right>riscrivi mail</th>
    <td><input ID="txtEmail_1" name="txtEmail_1" size="20" maxlength="50"></td>
    </tr>
    <tr>
    <td colspan="4"></td>
    </tr>
    <tr>
    <th align=right>Username</th>
    <td><input ID="txtUsername" name="txtUsername" size="20" maxlength="20"></td>
    <th align=right>Password</th>
    <td><input type="password" ID="txtPassword" name="txtPassword" size="20" maxlength="20"></td>
    </tr>
    <tr>
    <td colspan="4"></td>
    </tr>
    <tr>
    <td align=left colspan="4">Scrivi una domanda. Questa ti verrà posta se dimenticherai la tua password. Se la risposta coinciderà_con quella che indichi sotto, la password ti
    verrà inviata automaticamente dal sistema.</td>
    </tr>
    <tr>
    <td align=left>Domanda... (ad es. Come si chiama il mio cane?)</td>
    <td colspan="3" valign="bottom"><input ID="txtDomanda" name="txtDomanda" size="20" maxlength="50"> (max 50 caratteri)</td>
    </tr>
    <tr><td>
    </td></tr>
    <tr>
    <th align=right>Risposta...</th>
    <td colspan="3"><input ID="txtRisposta" name="txtRisposta" size="20" maxlength="30"> (max 30 caratteri)</td>
    </tr>
    <tr>
    <td colspan=4 align=center>

    <input type=submit value="r e g i s t r a t i" ID="cmdConf" name="cmdConf" >&nbsp&nbsp&nbsp<input type="button" name="btnAnnulla" value="Annulla" onclick="javascript: location.href = 'index.asp';" ID="Button1">



    </td>
    </tr>
    </table>
    </form>
    </div>




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.