Why is reference to composite component validator not resolved?

85 Views Asked by At

I want to attach custom validator to one of my input fields inside composite component, however the validator is not firing at all. I have done it exactly as described here, but I can't get it working. Also in my code, the reference to composite component input validator (for="validateService") is marked red cannot resolve symbol 'validateService'. What am I doing wrong?

component.xhtml

<cc:interface>
    <cc:attribute name="service"/>
    <cc:editableValueHolder name="validateService" targets="#{cc.attrs.service}"/>
</cc:interface>

page.xhtml

<cc:myComponent id="input"
        service="#{myBean.service}"
    <f:validator validatorId="serviceValidator" for="validateService"/>
</cc:myComponent>
1

There are 1 best solutions below

0
On

I solved it by adding validator directly inside the composite pomponent input field like this

<p:inputText id="service"
             validator="serviceValidator"/>

But i still have no idea why above solution doesn't work.