Buy Now
Sign in

field validationrules searched in container

emmexx , December 04 2017
In a rather complex form I enable/disable, enable/disable validation based on the values of a couple of checkboxes.
I set one field (a textarea) as Required and validation Disabled.
I add an event to a checkbox that enables validation using as identifier a class. I added the class in the Container class property of the field (the textarea).
When I check the checkbox nothing happens, the validation is not applied.

I checked the js code that cf adds to the form, in particular the following lines:
if(jQuery.inArray('enable_validation', event.action) > -1){
    var vrules ='validationrules'); //*** this line never runs
    vrules['disabled'] = 0;'validationrules', vrules);

The line that I marked in blue is never run.
If I understand correctly the code, the validation rules are searched for in the container, not in the textarea.

Is that correct?

I found out that a similar problem happens with the enable or disable event. When the Element(s) identifier property is a class, the js code tries to remove the disabled class from the container, not from the input element:
if(jQuery.inArray('enable', event.action) > -1){
  event_target.prop('disabled', false);
  if(event_target.prop('tagName') == 'SELECT'){

Am I using the class feature the wrong way?