Set value="" for the first option and required:true for the field, thats all.

Jörn

On Fri, Mar 6, 2009 at 3:50 PM, noon <nun...@gmail.com> wrote:
>
> I'm trying to throw the field is required option on a select when its
> selected option is my default option of dashes/0.  I might be going
> about this the complete wrong way with the required (dependency-
> callback). Help is appreciated.  My HTML/JS may make more sense than
> this quesiton
>
> HTML:
> <select name="threshold" id="threshold" class="required">
>        <option value="0"
> selected="selected">&mdash;&mdash;&mdash;&mdash;&mdash;</option>
>        <option value="65">65&#37;</option>
>        <option value="70">70&#37;</option>
>        <option value="75">75&#37;</option>
>        <option value="80">80&#37;</option>
>        <option value="85">85&#37;</option>
>        <option value="90">90&#37;</option>
>        <option value="95">95&#37;</option>
>        <option value="100">100&#37;</option>
> </select>
>
> JS:
> $('#mount-form').validate({
>        rules: {
>                threshold {
>                        // I don't want to allow the selected option be 0
>                        required: function(element) {
>                                return $('#threshold option:selected').val() 
> == '0';
>                        }
>                }
>        }
> });

Reply via email to