af:subform, required fields and immediate="true"
By Frank Nimphius on Nov 17, 2010
The component tag documentation for the af:subform component
states that ...
"the rich subform represents an independently submittable region of a page. The contents of a subform will only be validated (or otherwise processed) if a component inside of the subform is responsible for submitting the page or if the default attribute is set to true. This allows for comparatively fine-grained control of which components will be validated and pushed into the model without the compromises of using entirely separate form elements"
A known limitation, which is not yet documented, is for when input components within any of the sub forms of a page have their "immediate" property set to true. In this case validation is performed even if the component is not located in the submitted af:subform. The reason for this behavior is within the JSF lifecycle: Each af:subform tries to determine whether it has been submitted or not in a later part of the apply request phase. So if one of the input field components has its "immediate" property set to true, its validation is processed before the af:subform I is in has a chance to detect whether it has been submitted or not. As a result validation errors are shown. So when using af:subform, ensure none of the contained fields has its immediate property set to true.