Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 14
  1. #1
    Utente di HTML.it L'avatar di lelenet
    Registrato dal
    Feb 2002
    Messaggi
    207

    invio modulo tramite tast

    Ciao a tutti,

    Ho un menu a tendina ed un pulsante inseriti in un form, vorrei che schiacciando il tasto "enter" dopo aver fatto la scelta, mi invii il modulo senza bisogno di premere per forza il pulsante, come posso fare??

    Grazie mille!!!

  2. #2
    Semplice:

    nella SELECT:

    onChange="document.nomedellaform.submit();"

    Ciao!
    "Le uniche cose che sbagli sono quelle che non provi a fare."
    Atipica

  3. #3
    Utente di HTML.it L'avatar di lelenet
    Registrato dal
    Feb 2002
    Messaggi
    207
    non mi funziona??!!

  4. #4
    Posta il codice!
    "Le uniche cose che sbagli sono quelle che non provi a fare."
    Atipica

  5. #5
    Utente di HTML.it L'avatar di lelenet
    Registrato dal
    Feb 2002
    Messaggi
    207
    <form name="modulo" method="post" onSubmit="Controllo()">
    <select name="lista" onChange="document.modulo.submit();">
    <option value="brusson" <%if loc="brusson" then%> selected <%end if%>>Brusson</option>
    <option value="gaby" <%if loc="gaby" then%> selected <%end if%>>Gaby</option>
    <option value="valgrisenche" <%if loc="valgrisenche" then%> selected <%end if%>>Valgrisenche</option>
    <option value="rhemes" <%if loc="rhemes" then%> selected <%end if%>>Rhemes
    Notre Dame</option>
    <option value="pila" <%if loc="pila" then%> selected <%end if%>>Pila</option>
    <option value="champorcher" <%if loc="champorcher" then%> selected <%end if%>>Champorcher</option>
    </select>

    <input name="Button" type="submit" value="Vai">
    </form>

  6. #6
    E la funzione Controllo che cosa fa?

    Forse è meglio se posti anche quella...
    "Le uniche cose che sbagli sono quelle che non provi a fare."
    Atipica

  7. #7
    <form name="modulo" method="post" onSubmit="return Controllo()">
    <select name="lista" onChange="document.modulo.submit();">
    <option value="brusson" <%if loc="brusson" then%> selected <%end if%>>Brusson</option>
    <option value="gaby" <%if loc="gaby" then%> selected <%end if%>>Gaby</option>
    <option value="valgrisenche" <%if loc="valgrisenche" then%> selected <%end if%>>Valgrisenche</option>
    <option value="rhemes" <%if loc="rhemes" then%> selected <%end if%>>Rhemes
    Notre Dame</option>
    <option value="pila" <%if loc="pila" then%> selected <%end if%>>Pila</option>
    <option value="champorcher" <%if loc="champorcher" then%> selected <%end if%>>Champorcher</option>
    </select>

    <input name="Button" type="submit" value="Vai">
    </form>

    N.B. il tasto invio in un form funziona esattamente come hai detto tu... invia il form... senza bisogno di cliccare sul bottone submit e senza bisogno di nessun JS!
    Aggiungo inoltre che lo invia... sempre che la funzione Controllo() lo permetta
    «Se leggi dimentichi, se vedi capisci, se fai impari» Piaget

  8. #8
    Utente di HTML.it L'avatar di lelenet
    Registrato dal
    Feb 2002
    Messaggi
    207
    ecco la funzione controllo:

    function Controllo(){

    var lista = document.modulo.lista.value;

    if ((lista == "") || (lista == "undefined")) {
    alert("la scelta della località è obbligatoria!");
    document.modulo.lista.focus();
    return false;
    }

    else {
    var localita=document.modulo.lista.value;
    document.modulo.action = "default_i.asp?loc="+localita;
    document.modulo.submit();
    }
    }

  9. #9
    Utente di HTML.it
    Registrato dal
    Dec 2001
    Messaggi
    3,259
    prova una cosa di questo genere

    <script>
    function Controllo(){

    var lista = document.modulo.lista.value;

    if ((lista == "") || (lista == "undefined")) {
    alert("la scelta della località è obbligatoria!");
    document.modulo.lista.focus();
    return false;
    }

    else {
    var localita=document.modulo.lista.value;
    document.modulo.action = "default_i.asp?loc="+localita;
    return true
    }
    }
    </script>

    <form name="modulo" method="post" onSubmit="return Controllo()">
    <select name="lista" onChange="document.modulo.submit();">
    <option value="brusson" <%if loc="brusson" then%> selected <%end if%>>Brusson</option>
    <option value="gaby" <%if loc="gaby" then%> selected <%end if%>>Gaby</option>
    <option value="valgrisenche" <%if loc="valgrisenche" then%> selected <%end if%>>Valgrisenche</option>
    <option value="rhemes" <%if loc="rhemes" then%> selected <%end if%>>Rhemes
    Notre Dame</option>
    <option value="pila" <%if loc="pila" then%> selected <%end if%>>Pila</option>
    <option value="champorcher" <%if loc="champorcher" then%> selected <%end if%>>Champorcher</option>
    </select>

    <input name="Button" type="submit" value="Vai">
    </form>

  10. #10
    Utente di HTML.it L'avatar di lelenet
    Registrato dal
    Feb 2002
    Messaggi
    207
    niente da fare, non mi funziona il tasto invio!! non mi da nessun segnale, come se non premessi niente!!

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.