select-options don't have a checked property. You have to fix the selector "#AltraVia:checked".
Jörn On Mon, May 18, 2009 at 10:33 AM, ciupaz <luigi.zambe...@gmail.com> wrote: > > Hi all, > I have this validate code to validate a textbox if the user select a > combo value: > > <script type="text/javascript"> > > $(document).ready(function() { > $("form#2form").validate({ > rules: { > viaAltro: { > required: "#AltraVia:checked" > } > }, > > messages: { > viaAltro: { > required: "Insert 'Altra via'" > } > > } > }) > }); > </script> > > > and this is the HTML: > > <select name="viaFornitura" id="viaFornitura"> > <option>Seleziona la via</option> > <option id="AltraVia">Altro</option> > </select> > > <label for="viaAltro">Altra via</label> > <input name="viaAltro" id="viaFornituraAltro" type="text" /> > > > but it doesn't work. > Where the problem? > > Thanks a lot. > > Luigi