开发者

render error message on a new line

I have this ice faces component with validator:

<ice:inputText id="#{id}" value="#{bean[field]}" required="#{required}"
    rendered="#{rendered}" styleClass="#{inputCssStyle}">
    <f:validator validatorId="#{validatorId}" />
</ice:inputText>
<br />
<ice:message style="color: red;" id="ageError" for="#{id}" />

As you see, I do want ice:message to be rendered under the input text so I put a < br /> tag. The problem is that if there is no error the br tag will still be there and I do not want that...

Do you see how can I check if there is an error for this field (wit开发者_Python百科hout using a property from the validator bean) directly in the xhtml page...?

Thanks.


You should use css for that: display: block;, no need for the br tag.

<ice:message style="color: red; display: block;" id="ageError" for="#{id}" />


<ice:panelGroup>
<ice:inputText id="#{id}" value="#{bean[field]}" required="#{required}"
    rendered="#{rendered}" styleClass="#{inputCssStyle}">
    <f:validator validatorId="#{validatorId}" />
</ice:inputText>
<ice:panelGroup>
<ice:message style="color: red;" id="ageError" for="#{id}" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜