[英]How to highlight a PrimeFaces textbox with red color border on required validation error?
I have a PrimeFaces textbox with autocomplete functionality.我有一个具有自动完成功能的 PrimeFaces 文本框。 For required field validation error i have to show the error message and highlight the textbox with red color border.
对于必填字段验证错误,我必须显示错误消息并突出显示带有红色边框的文本框。 I have showed the error message with
<h:message>
how to highlight the textbox with red color border.我已经用
<h:message>
显示了错误消息如何突出显示带有红色边框的文本框。
My textbox is mentioned below.下面提到了我的文本框。
<p:focus context="accountNo">
<p:autoComplete id="accountNo" value="#{orderController.accountNo}"
completeMethod="#{orderController.getAccountAutoComplete}"
forceSelection="true" styleClass="ui-inputfield" requiredMessage="Account number is required" required="true"/>
<h:message for="accountNo" style="color:red" />
</p:focus>
You can use <p:message>
with for
attribute set to id of textbox.您可以将
<p:message>
与for
属性设置为文本框的 id 一起使用。
For example:例如:
<p:inputText id="id" value="#{bean.idd}" />
<p:message for="id" display="icon" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.