An action class has a property to be validated. The property is a class (MyClass1), one of whose properties is also a class (MyClass2).
Each of the classes to be validated will be used by multiple actions, so I defined a "MyClass*-validation.xml" for each.
The problem I am having is trying to use the visitor validator in MyClass1 to validate MyClass2.
MyAction-validation.xml:
<validators>
<field name="class1">
<field-validator type="visitor">
<message></message>
</field-validator>
</field>
</validators>
MyClass1-validation.xml:
<validators>
<field name="class2">
<field-validator type="visitor">
<message></message>
</field-validator>
</field>
</validators>
MyClass2-validation.xml:
<validators>
<field name="myInt">
<field-validator type="conversion">
<message>myInt conversion</message>
</field-validator>
</field>
</validators>
If I submit a form with field class1.class2.myInt="a", fieldErrors() does not contain the conversion error, as was my expectation.
Is it possible to chain visitor validators indefinitely, or is one level of visitor the maximum? If it is possible, what am I doing wrong?
Undesirable (in my opinion) solution/workaround: Since I couldn't figure out what I was doing wrong, I eventually tried not chaining the validation from MyClass1-validation.xml to MyClass2-validation.xml, and instead changed the definition of MyAction-validation.xml:
<validators>
<field name="class1.class2">
<field-validator type="visitor">
<message></message>
</field-validator>
</field>
<field name="class1">
<field-validator type="visitor">
<message></message>
</field-validator>
</field>
</validators>
This change addressed the problem (fieldErrors() now contains the conversion error), but I would very much prefer to be able to chain the validators as was my initial intention.