jsf高亮标签输入无效 [英] jsf highlight label for invalid input
问题描述
是否有可能将特定样式应用于无效的输入标签?
Is there a simple possibility to apply a specific style to input labels that are invalid?
我已经看到全屏突出显示组件可以完成输入本身的工作,但是给我的项目指定样式指南,将其作为输入标签.
I've seen omnifaces highlight component wich does the job for the input itself, but the given styleguide for my project, forces this for the label of the input.
这样的事情会很棒:
<h:outputLabel for="inputId" value="label" />
<h:inputText id="inputId" value="..." />
<o:highlight errorLabelStyle="errorLabel" />
推荐答案
对于<o:highlight>
,这是不可能的.但是,对标签应用相同的样式类也相对简单,因此已已实现一个>.根据 OmniFaces 1.2,您可以按以下方式使用它:
This was not possible with <o:highlight>
. It's however relatively simple to apply the same style class for the labels as well, so it has been implemented. As per OmniFaces 1.2, you can use it as follows:
<h:outputLabel for="inputId" value="label" />
<h:inputText id="inputId" value="..." />
<o:highlight />
使用以下CSS:
label.error {
color: red;
}
input.error, select.error, textarea.error {
background: pink;
}
默认clye类名称error
可以用通常的方法覆盖:
The default stlye class name of error
is overrideable the usual way:
<o:highlight styleClass="invalid" />
这篇关于jsf高亮标签输入无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!