我正在使用jsf和Primefaces組件。我需要根據輸入值來執行命令按鈕。這是我的html代碼:commandButton in if控件未調用
<h:form id="mainform">
<p:panel id="panelform" header="Email Extractor" >
<h:panelGrid id="formulaire" columns="2">
<h:panelGroup id="formblock" layout="block" >
<p:panelGrid columns="2">
<p:outputLabel for="Emailsnbr" value="Enter the emails'number:" />
<p:inputText id="Emailsnbr" type="number" requiredMessage="Emails number is required"
value="#{mailMB.number}" required="true" label="Emailsnbr">
</p:inputText>
</p:panelGrid>
</h:panelGroup>
</h:panelGrid>
<c:if test="#{mailMB.number gt 10}">
<p:commandButton value="Extract" style="width: 8%;height: 100%" update="tableemails, :confirmPurchase, :mainform" id="extractbutton" ajax="true" widgetVar="ButtonExtract"
actionListener="#{mailMB.searchEmails()}"
oncomplete="if (args && !args.validationFailed) purchase.show();"/>
</c:if>
<c:if test="#{mailMB.number lt 11}">
<p:commandButton value="Extract" style="width: 8%;height: 100%" update="tableemails, :confirmPurchaseTest, :mainform" id="extractbuttonTest" ajax="true" widgetVar="ButtonExtract"
actionListener="#{mailMB.searchEmails()}"
oncomplete=" if (args && !args.validationFailed) emailsList.show();"/>
</c:if>
</p:dialog>
</p:panel>
</h:form>
命令按鈕在標籤<c:if test="#{mailMB.number lt 11}">
總是被調用,從來沒有一在標籤<c:if test="#{mailMB.number gt 10}">
任我進入9或15爲數字輸入的值。 任何解釋和幫助如何使這項工作?
'oncomplete'屬性的唯一區別是什麼?那麼爲什麼不抓住那裏的所需價值呢? – mabi
@mabi是隻有oncomplete屬性不同。我沒有得到你的建議,你能說清楚嗎? –