I have a form field that by default has the value "First".  When the
user clicks into the field it clears that value, and if they type
nothing, when they blur the field it replaces "First".  You've all
seen this.
I want the validate plugin to say this field is required if the value
onsubmit is "First".  Can't seem to make it work.
[code]
// validate signup form on keyup and submit
                $("#contactform").validate({
                        rules: {
                                name_first: {
                                        required: function(element) {
                                                return $
('#name_first').val() != "First";
                                                }
                                        },
                                name_last: "required",
                                country: "required",
                                otherinfo: "required",
                                email: {
                                        required: true,
                                        email: true
                                }
                        }
                });
<input type="text" name="name_first" value="First" size="15"
id="name_first" class="inputfield_name swaptextbox greybox"
tabindex="1" />
[/code]
Once I do that, I'll use the same code for last name.

Reply via email to