Visualizzazione dei risultati da 1 a 6 su 6

Discussione: Help: Radio button

  1. #1

    Help: Radio button

    Salve.
    Con la nuova legge sulla privacy adesso le cose si fanno più complicate: :master:

    Ho creato una form per farmi mandare delle mail direttamente dal sito, alla fine di questo form volevo aggiugere due radio button che mi indicavano se l'utente accettava il trattamento dei dati personali oppure no.
    Se selezionava "accetto", allora la mail veniva spedita ( ops.... :gren: dimenticavo: per mandare la mail uso l'oggetto CDOSYS )altrimenti non la spediva.
    Come faccio tutto cio'? Praticamente come faccio il controllo sui radio button?
    Grazie :gren:

  2. #2
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    Esempio:

    codice:
    <script>
    function controlla(f) {
    if (!f.acc[0].checked) {
     alert("Devi accettare")
     return false
    }
    }
    </script>
    
    ...
    
    <form ... onsubmit=return"controlla(this);">
    ...
    <input type=radio value="si" name="acc"> accetto 
    
    <input type=radio value="no" name="acc"> rifiuto 
    
    ...
    </form>
    ciao
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

  3. #3
    <HTML>
    <HEAD>
    .............
    </HEAD>

    <script>
    function controlla(f) {
    if (!f.acc[0].checked) {
    alert("Devi accettare")
    return false
    }
    }
    </script>

    <BODY BGCOLOR=#FFFFFF text="#333333">
    </p>
    <table border="0" cellpadding="0" cellspacing="0" width="40%" align="center">
    <tr>
    <td width="100%">
    <form action="formcdosys.asp" method="post" name="form1" onsubmit=return"controlla(this);">

    .................
    <input type=radio value="si" name="acc" checked> Accetto

    <input type=radio value="no" name="acc"> Rifiuto

    .................

    <input type="submit" name="Submit" value=" Invia ">
    </form>



    L'ho provato (in locale IIS 4) ma penso che non vada, sia nel caso che seleziono Accetto oppure Rifiuto manda la mail

  4. #4
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    Scusa, c'e' un delimitatore fuo<form action="formcdosys.asp"

    onsubmit="return controlla(this);"

    ciao
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

  5. #5
    Scusate....
    sarà poca conoscenza della materia (sicuramente)
    o demenza senile (troppo giovane)

    ecco il codice:
    Cosa c'e che non va????

    <HTML>
    <HEAD>
    <TITLE>modulo</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    </HEAD>
    <script>
    function controlla(f) {
    if (!form1.acc[0].checked ){
    alert("Devi Autorizzare il trattamento dei dati personali")
    return false
    }
    }

    </script>

    <BODY BGCOLOR=#FFFFFF text="#333333">
    </p>
    <table border="0" cellpadding="0" cellspacing="0" width="40%" align="center">
    <tr>
    <td width="100%">
    <form method="post" name="form1" onsubmit=return"controlla(this);" action="formcdosys.asp">
    <table width="423" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" height="251">
    <tr>
    <td width="77" height="15">
    <font size="2" color="#333333">
    Nome</font></td>
    <td width="338" colspan="2" height="15">
    <font color="#333333" size="2" face="Times New Roman">

    <input type="text" name="nome" size="20">
    </font></td>
    </tr>
    <tr>
    <td width="77" height="20">
    <font size="2" color="#333333">
    Cognome</font></td>
    <td width="338" colspan="2" height="20">
    <font color="#333333" size="2" face="Times New Roman">

    <input type="text" name="cognome" size="20">
    </font></td>
    </tr>
    <tr>
    <td width="77" height="20">
    <font size="2" color="#333333">Via</font></td>
    <td width="338" colspan="2" height="20">
    <font face="Times New Roman" size="2" color="#333333">

    <input name="via" type="text" id="altro" size="20">
    </font></td>
    </tr>
    <tr>
    <td width="77" height="20"><strong style="font-weight: 400">
    <font size="2">Città</font>[/b]</td>
    <td width="338" colspan="2" height="20">
    <font color="#333333" size="2" face="Times New Roman">

    <input type="text" name="città" size="20">
    </font></td>
    </tr>
    <tr>
    <td width="77" height="20"><strong style="font-weight: 400">
    <font size="2">Provincia</font>[/b]</td>
    <td width="338" colspan="2" height="20">

    <font face="Times New Roman">
    <select name="select">
    <option value="numero1">opzione01</option>
    <option value="numero1">opzione02</option>
    <option selected>scegli opzione</option>
    </select></font>
    </td>
    </tr>
    <tr>
    <td width="77" height="20"><strong style="font-weight: 400">
    <font size="2" color="#333333">
    Telefono</font>[/b]</td>
    <td width="338" colspan="2" height="20">
    <font color="#333333" size="2" face="Times New Roman">

    <input type="text" name="tel" size="20">
    </font></td>
    </tr>
    <tr>
    <td width="77" height="20"><strong style="font-weight: 400">
    <font size="2" color="#333333">
    E-mail</font>[/b]</td>
    <td width="338" colspan="2" height="20">
    <font color="#333333" size="2" face="Times New Roman">

    <input type="text" name="email" size="20">
    </font></td>
    </tr>
    <tr>
    <td width="77" height="82"><strong style="font-weight: 400">
    <font size="2" color="#333333">
    Messaggio</font>[/b]</td>
    <td width="338" colspan="2" height="82">

    <font size="1" color="#333333" face="Times New Roman">
    <textarea name="messaggio" rows="5" cols="33" wrap="VIRTUAL"></textarea>
    </font>

    </td>
    </tr>
    <tr>
    <td width="77" height="1">
    <p align="center"><strong style="font-weight: 400">
    <font style="font-size: 7pt">


    </font>[/b]</td>
    <td width="105" height="1">
    <p align="center"><strong style="font-weight: 400">
    <font style="font-size: 7pt">
    Legge sulla Privacy</font>[/b]</td>
    <td width="229" height="1">

    <font face="Times New Roman">
    <input type=radio value="si" name="acc" checked></font>
    Accetto

    <font face="Times New Roman">
    <input type=radio value="no" name="acc"></font>
    Rifiuto</td>
    </tr>
    </table>
    <p align="center">
    <font size="1" color="#333333" face="Verdana, Arial, Helvetica, sans-serif">
    <input type="submit" name="Submit" value=" Invia " style="border-style: solid; border-width: 1"></font></p>
    </form>
    </td>
    </tr>
    </table>
    </BODY>
    </HTML>

  6. #6
    Grazie ho risolto tutto.
    :adhone:

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