开发者

JSF Validation Required Fields

I'm using primefaces and their growl control in order to display validation error messages and I would like to use the required="true" but customize the message for ea开发者_JAVA技巧ch input component that uses the required="true". I know you can override the default require message and I know you can create a server side check and add a FacesMessage, but can you use required=true and customize the message? Right now it uses the id which doesn't work well for things "First Name"


If you mean that the customization of message is changing the content of the required message then,

<h:inputText id="fn" required="true" requiredMessage="Firstname Can not be Blank" label="Firstname" value="#{user.firstname}"/>                           

<h:inputText id="ln" required="true"  requiredMessage="Lastname Can not be Blank" label="Lastname" value="#{user.lastname}"/>

You have to specify the requiredMessage attribute.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜