why not use simple JavaScript?

  required: function(element) {
                                return element.selectedIndex > 0;
                        }

(Note: i don't use that plugin, but i assume returning "true" is "pass
validation")


On Mar 6, 9:50 am, 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