Interesting thanks. I will see if I can't make some invalidate method
for every condition. Somehow I think that's easier to maintain.

I will  have to lookup if I can add multiple methods to such click-event.

Thanks. Wow, jQuery makes your live a lot easier.

Yours,
Weyert

On Tue, Oct 7, 2008 at 9:50 PM, Jörn Zaefferer
<[EMAIL PROTECTED]> wrote:
> Showing and hiding fields based on user-defined conditions isn't part
> of the validation plugin. But it should be easy enough to implement
> with jQuery. To get you started, something like this:
>
> $("#someCheckboxA").click(function() {
>  var toggleThose = $("#fieldQ, fieldR");
>  if (this.checked) {
>    toggleThose.show();
>  } else {
>    toggleThose.hide();
>  }
> });
>
> That could also be written as:
>
> $("#someCheckboxA").click(function() {
>  $("#fieldQ, fieldR")[ this.checked ? "show" : "hide" ]();
> });
>
> Jörn
>
> On Tue, Oct 7, 2008 at 8:56 PM, Weyert de Boer <[EMAIL PROTECTED]> wrote:
>>
>> Hello!
>>
>> I am currently trying to use the validation plugin for jQuery to
>> improve my current code generator for making forms.
>> I would like to support conditional fields, meaning that it shows or
>> hides other fields depending on the evaluation of a conidition.
>> For example, if fieldA is B then it should show fieldQ, fieldR. If not
>> it should hide.
>>
>> Are there any way to do this easily with jQuery and it's validation plugin?
>>
>> Thanks!
>> Weyert de Boer
>>
>

Reply via email to