Can you give me an example of it in use - I'm currently just using;

$("#admin-jobs").validate();

Should I be using (where two things are required) it like this?:

$("#admin-jobs").validate(
        required: "select#salary_lower:filled"
        required: "select#salary_higher:filled"
        required: function() {
                // only required when the second option is selected
                return jQuery("select#jobtype")[0].selectedIndex == 1;
        }
);


Thanks,
Luc

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jörn 
Zaefferer
Sent: 09 May 2007 19:42
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: toggleClass and {required:true}


Luc,

there are two possible solutions: Hack the metadata plugin by setting metaDone 
on the "toggled" element to false. That causes the metadata to be read again. I 
recommend a different approach: Use the required-with-dependency feature to 
make the validation more dynamic. 
You can use both jQuery expressions and functions as the argument to required, 
for example:

// required only when field #someValue is not blank
required: "input#someValue:filled"
required: function() {
        // only required when not the first option is selected
        return jQuery("select#month")[0].selectedIndex != 0; }

I hope you get the idea, let me know if it works for you.

Regards
Jörn 

In2
Thames House
Mere Park
Dedmere Road
Marlow
Bucks
SL7 1PB

Tel 01628 899700
Fax 01628 899701
e: [EMAIL PROTECTED]
i: www.in2.co.uk

This message (and any associated files) is intended only for the use of 
jquery-en@googlegroups.com and may contain information that is confidential, 
subject to copyright or constitutes a trade secret. If you are not 
jquery-en@googlegroups.com you are hereby notified that any dissemination, 
copying or distribution of this message, or files associated with this message, 
is strictly prohibited. If you have received this message in error, please 
notify us immediately by replying to the message and deleting it from your 
computer. Messages sent to and from us may be monitored. Any views or opinions 
presented are solely those of the author [EMAIL PROTECTED] and do not 
necessarily represent those of the company.

Reply via email to