Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. jessica1234
    3. Post
    J

    jessica1234

    @jessica1234

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 2
    • Post 2
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    Località milano Età 35
    0
    Reputazione
    2
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da jessica1234

    • controllo form con javascript

      ecco il codice html:
      <form name="contform">
      <table>
      <tr>
      <td><em>Nome</em></td>
      <td><input type="text" size"30" maxleght="28" name="nome"></td>
      </tr>
      <td><em>Email</em></td>
      <td><input type="text" size="30" maxleght="28" name="email"</td>
      </tr>
      <tr>
      <td><em>Argomento</em></td>
      <td>
      <select name="argomento">
      <option value="-">- Scegli un argomento -</option>
      <option value="prob">Problemi tecnici</option>
      <option value="sugg">Suggerimenti</option>
      <option value="altro">Altro</option>
      </select>
      </td>
      </tr>
      <tr>
      <td><em>Testo</em></td>
      <td>
      <textarea rows="5" cols="30" name="testo"></textarea>
      </td>
      </tr>
      </table>
      <br>
      <hr size="2" width="450" align="left">
      <input type="reset" value="Annulla">     
      <input type="button" value="Invia" onClick="ControllaForm();" />
      </form>

      ecco la funzione che ho creato ma che non funziona per controllare la validità del form:
      <script language="javascript">
      <!-- function ControllaForm() {
      var nome = document.contform.nome.value;
      var email_reg_exp = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-]{2,})+.)+([a-zA-Z0-9]{2,})+$/;
      var argomento = document.contform.argomento.options
      [document.contform.argomento.selectedIndex].value;
      var testo = document.contform.testo.value;
      //Controllo nome
      if ((nome == "") || (nome == "undefined")) {
      alert('Il campo Nome è obbligatorio.');
      document.contform.nome.focus();
      return false;
      }
      //Controllo indirizzo email valido
      else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
      alert("Inserire un indirizzo email corretto.");
      document.contform.email.select();
      return false;
      }
      //Controllo argomento
      else if ((argomento == "") || (argomento == "undefined")) {
      alert("Il campo Argomento è obbligatorio.");
      document.contform.argomento.focus();
      return false;
      }
      //Controllo testo
      if ((testo == "") || (testo == "undefined")) {
      alert("Il campo Testo è obbligatorio.");
      document.contform.testo.focus();
      return false;
      }
      //Invia form
      else {
      document.contform.action = "elabora_dati.asp";
      document.contform.submit();
      }
      }
      //-->
      </script>

      MA DOVE SBAGLIO?????
      chi mi può aiutare???
      grazie mille!!!

      postato in Help Center: consigli per il tuo progetto
      J
      jessica1234
    • aiuto javascript controllo form

      ecco il codice html:
      <form name="contform">
      <table>
      <tr>
      <td><em>Nome</em></td>
      <td><input type="text" size"30" maxleght="28" name="nome"></td>
      </tr>
      <td><em>Email</em></td>
      <td><input type="text" size="30" maxleght="28" name="email"</td>
      </tr>
      <tr>
      <td><em>Argomento</em></td>
      <td>
      <select name="argomento">
      <option value="-">- Scegli un argomento -</option>
      <option value="prob">Problemi tecnici</option>
      <option value="sugg">Suggerimenti</option>
      <option value="altro">Altro</option>
      </select>
      </td>
      </tr>
      <tr>
      <td><em>Testo</em></td>
      <td>
      <textarea rows="5" cols="30" name="testo"></textarea>
      </td>
      </tr>
      </table>
      <br>
      <hr size="2" width="450" align="left">
      <input type="reset" value="Annulla">     
      <input type="button" value="Invia" onClick="ControllaForm();" />
      </form>

      ecco la funzione che ho creato ma che non funziona per controllare la validità del form:
      <script language="javascript">
      <!-- function ControllaForm() {
      var nome = document.contform.nome.value;
      var email_reg_exp = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-]{2,})+.)+([a-zA-Z0-9]{2,})+$/;
      var argomento = document.contform.argomento.options
      [document.contform.argomento.selectedIndex].value;
      var testo = document.contform.testo.value;
      //Controllo nome
      if ((nome == "") || (nome == "undefined")) {
      alert('Il campo Nome è obbligatorio.');
      document.contform.nome.focus();
      return false;
      }
      //Controllo indirizzo email valido
      else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
      alert("Inserire un indirizzo email corretto.");
      document.contform.email.select();
      return false;
      }
      //Controllo argomento
      else if ((argomento == "") || (argomento == "undefined")) {
      alert("Il campo Argomento è obbligatorio.");
      document.contform.argomento.focus();
      return false;
      }
      //Controllo testo
      if ((testo == "") || (testo == "undefined")) {
      alert("Il campo Testo è obbligatorio.");
      document.contform.testo.focus();
      return false;
      }
      //Invia form
      else {
      document.contform.action = "elabora_dati.asp";
      document.contform.submit();
      }
      }
      //-->
      </script>

      MA DOVE SBAGLIO?????
      chi mi può aiutare???
      grazie mille!!!

      postato in Coding
      J
      jessica1234