Ho creato questa funzione:
Viene richiamata nel seguente modo:codice:function enabledisable() { if (document.getElementById) { // DOM3 = IE5, NS6 if (document.getElementById('group').checked) { document.getElementById('enabledisable').disabled=false; } else { document.getElementById('enabledisable').disabled=true;}} }
In un file html semplice ciò funziona alla grande, ma se all'interno del tag <form> metto delle tabelle, e richiamo <select id="enabledisable" multiple="multiple" disabled="disabled"> e <input id="group" type="checkbox" onClick="enabledisable()" /> dentro due <td></td>, tutto ciò non funziona. Se invece lascio il select dentro la tabella e input lo metto in fondo al file html FUORI dal form, tutto funziona. Sto impazzendo! Forse ho sbagliato a mettere dentro il tag form le tabelle... potrebbe essere quello il problema?codice:<select id="enabledisable" multiple="multiple" disabled="disabled"> ... </select> <input id="group" type="checkbox" onClick="enabledisable()" />
Per i veterani, posto il mio codice html, sperando che ci sia qualcuno che, grazie al dettaglio misto alla sua pazienza, possa aiutarmi a trovare la ragione del problema. Un grazie in anticipo!
codice:<form name="creautente" id="creautente" action="index.php?option=com_rubrica&task=creaUtente" method="post"> <div class="contenitore"> <table class="sx"> <tr> <td>Nome</td> <td><input type="textbox" name="nome" id="nome" /></td> </tr> <tr> <td>Cognome</td> <td><input type="textbox" name="cognome" id="cognome" /></td> </tr> <tr> <td>Cellulare</td> <td><input type="textbox" name="cellulare" id="cellulare" /></td> </tr> <tr> <td>Casa</td> <td><input type="textbox" name="casa" id="casa" /></td> </tr> <tr> <td>Ufficio</td> <td><input type="textbox" name="ufficio" id="ufficio" /></td> </tr> <tr> <td>Fax</td> <td><input type="textbox" name="fax" id="fax" /></td> </tr> <tr> <td>Email</td> <td><input type="textbox" name="email" id="email" /></td> </tr> </table> <table> <tr> <td><input id="group" type="checkbox" onClick="enabledisable()" /></td> <td>Gruppi</td> <td><select id="enabledisable" multiple="multiple" disabled="disabled"> <?php foreach ($this->gruppi as $gruppo) { echo '<option>'.$gruppo->descrizione.'</option>'; }?> </select></td> </tr> </table> </div> </form>

Rispondi quotando