tags:

views:

312

answers:

1

I am using fValidator plugin for MooTools, and find necessary to control (depending on user selections) the required class it's used by the plugin.

The class uses a weird formatting which have never used before and for some reason mootools can recognize it. It probably has something to do with escaping the square brackets and the single quotes.

I tried something like this, among other things, but no luck yet:

$("checkbox3").removeClass("fValidate\[\'required\'\]");

A: 

Are you looking to remove/add required elements to the validation? As it picks up all the elements at first you'd have to unregister them, remove the class and then re-register them.

Unfortunately it doesn't seem to have an unregister method by default so you'd have to monkey patch the script to add this, also as the register method doesn't parse class names you'd have to add a new method that does this. Finally you'd have to make the event that is added to the field for the blur in register a binding that you could re-use the binding to remove that event

It's quite an involved patch/rewrite of fValidator to achieve this and if possible I would look at another validation script -- such as form check which does allow you to un-register and re-register fields at run time (among a lot of other improvements).

DEfusion
hmm. I'm not sure i understand the whole register thing, but now i'm curious and will check into this.
Sam3k