I am extending HtmlOutputLabel adding a "*" when its for component is
required.

I am almost successful but I am having a problem.
The "*" is not rendered the first time the page is rendered.

The problem, is that findComponent does not find the "for" component
using findComponent the first time:

[...]
public EditableValueHolder getInputFor(){
        UIComponent uiFor = findComponent(getFor());
        if (uiFor == null || !(uiFor instanceof EditableValueHolder))
                return null;
        return (EditableValueHolder) uiFor;
}

[...]
EditableValueHolder uiFor = uiLabel.getInputFor();
if (uiFor == null || !((EditableValueHolder) uiFor).isRequired())
        return;


[...]

<f:view>
        <h:form>
                <csa:outputLabel id="ol" value="Hello world" for="it""/>
                <t:inputText id="it" required="true" />
                <t:commandButton id="cb" value="Button"/>
        </h:form>
        <t:messages />
</f:view>

Why it is not find 


Reply via email to