o:highlight
is a helper component which highlights all invalid UIInput
components and the
associated labels by adding an error style class to them. Additionally, it by default focuses the first invalid
UIInput
component. The <o:highlight />
component can be placed anywhere in the view, as
long as there's only one of it. Preferably put it somewhere in the master template for forms.
<h:form> <h:inputText value="#{bean.input1}" required="true" /> <h:inputText value="#{bean.input1}" required="true" /> <h:commandButton value="Submit" action="#{bean.submit}" /> </h:form> <o:highlight />
The default error style class name is error
. You need to specify a CSS style associated with the class
yourself. For example,
label.error { color: #f00; } input.error, select.error, textarea.error { background-color: #fee; }
You can override the default error style class by the styleClass
attribute:
<o:highlight styleClass="invalid" />
You can disable the default focus on the first invalid input element setting the focus
attribute.
<o:highlight styleClass="invalid" focus="false" />
Info | Value |
---|---|
Component Type | org.omnifaces.component.script.Highlight |
Handler Class | None |
Renderer Type | None |
Description | None |
Name | Required | Type | Description |
---|---|---|---|
id | false | javax.el.ValueExpression
(must evaluate to java.lang.String )
| The component identifier for this component. This value must be unique within the closest parent component that is a naming container. |
rendered | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
| Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true. |
binding | false | javax.el.ValueExpression
(must evaluate to javax.faces.component.UIComponent )
|
The ValueExpression linking this component to a property in a backing bean.
|
styleClass | true | javax.el.ValueExpression
(must evaluate to java.lang.String )
|
The error style class which is to be applied on invalid inputs. Defaults to error .
|
focus | false | javax.el.ValueExpression
(must evaluate to java.lang.Boolean )
|
Whether the first error element should gain focus. Defaults to true .
|
Output generated by Vdldoc View Declaration Language Documentation Generator.