How to handle AUI form-validation with dynamic fields?

I’m struggeling with the AUI form-validation on dynamical fields. For example there is a selectbox where one can choose a basic-type. The change-event of this selectbox is connected with 3 other selectboxes which are shown and hidden (using jQuery), depending on the selection of the main selectbox (the one containing the basic-type).
I’d like to have the dependent selectboxes as equired field, meaning if the visible depending selectbox’s value is empty that field should be invalidated, the other 2 invisible selectboxes should be set as valid or data-aui-validation-novalidate to skip the validation.

How to do that? Any Hints?

I Registered my on Validation like this:

AJS.formValidation.register(['isVisibleAndNotEmpty'], function(field) {
				if ($("#"+field.el.attributes.getNamedItem("id").value).parents("div:first").is(":visible") && field.el.value === "") {
			        field.invalidate('invalid bla bla bla');
			    } else {

the declarative part in the velocity:

<select id="gruppe-erstellen-dlg-group-bereich" class="select medium-long-field" data-aui-validation-field data-aui-validation-isVisibleAndNotEmpty='Wählen Sie einen Bereich aus.'>                
                            <option value="" disabled="disabled" selected="selected">--- Wählen Sie einen Bereich aus ---</option>
                            #foreach ($option in $gruppenBereichFilter)
                               <option value="$option.getKey()">$option.getDisplayTitle()</option>

But it seems like I can not unregister, revalidate it?

As far as I see it is not suposed for doing dynamic stuff - register the validation stuff for the form exactly one time, submit the form, validation gets “lost” because of the rerendering…

in order to “abuse” the functionality I did a quick an dirty workaround: each time the main select box changes I “unvalidate” each of the dependent selectboxes eg:


in my scenario this works fine!