Luc,
Hi Jörn,
I'd like to use your plugin, and I was up to a point, but the problem I'm 
having is three-fold. I'm sure it can be solved with your plugin, and I'd love 
to know how;

Ideally I'd like an example to get me started - assuming a select dropdown (#jobtype) 
with two options ('a', 'b') hiding/showing two relevant <div>s (#div-a #div-b) 
with a text field in each, what do I need in order for the input in #div-b to NOT be 
required when #div-a is shown, and #div-b is hidden?

I'm sure it's possible, but it's not documented as I need it on your site.
there are two example available that show how to build depdencies (second and third example jQuery.validator.methods.required): http://jquery.bassistance.de/api-browser/plugins.html#jQueryvalidatormethodsrequiredStringElementBooleanStringFunction

From what you describe, this should be enough:

//on input in div-a
{required:'#div-a:visible'}

//on input in div-b
{required:'#div-b:visible'}

Of course you can switch that:

//on input in div-a
{required:'#div-b:hidden'}

//on input in div-b
{required:'#div-a:hidden'}

That's it. Just provide a selector using jQuery's expression capabilites. The plugin itself adds ':blank' and ':filled' to check for filled or blank fields (trimming whitespace).

--
Jörn Zaefferer

http://bassistance.de

Reply via email to