【发布时间】:2015-01-09 02:11:53
【问题描述】:
我的问题是我在一个 xhtml 页面中有多个Primefaces 的commandButton。我需要的消息和验证器适用于它们中的每一个。这不是我想要的。我希望只有当我单击 ID 为“sendform”的命令按钮时,所需的消息和验证器才能工作
<p:growl id="growl" life="6000" />
<p:inputText id="fullName"
value="#{messageBean.fullName}"
required="true"
requiredMessage="You need to enter your full name to apply this form."
styleClass="contacttext"/>
<p:inputText id="email"
value="#{messageBean.email}"
required="true"
requiredMessage="You need to enter your email to apply this form."
validatorMessage="Invalid e-mail format">
<f:validateRegex pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
</p:inputText>
<p:commandButton id="sendform"
value="#{msg['sendUs']}"
actionListener="#{messageBean.sendMessage}"
update="growl fullName email textarea"
styleClass="sendus"/>
<p:commandButton id ="otherStuff"
value="otherStuff"
actionlistener="#{someBean.someWork}" />
<p:commandButton id ="anotherStuff"
value="anotherStuff"
actionlistener="#{anotherBean.anotherWork}" />
如何修复它以仅在此命令按钮上运行所需的消息?
<p:commandButton id="sendform"
value="#{msg['sendUs']}"
actionListener="#{messageBean.sendMessage}"
update="growl fullName email textarea"
styleClass="sendus"/>
【问题讨论】:
标签: jsf primefaces jsf-2.2