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