我需要验证一个<p:spinner>
值是否在设定范围内。
<p:spinner id="minutes" min="0" max="1000" value="#{printerSettings.t}" size ="1">
<f:validateLongRange minimum="0" maximum="1000" />
<p:ajax update="NewTime"/>
</p:spinner>
<h:message for="minutes" style="color:red" />
和
<p>Number of copies (Max of 50) :
<p:spinner id ="Copies" min="1" max="50" value="#{printerSettings.p}" size ="1"> <!-- allows the user a choice of up to 50, this is more than enough for any situation, if needed this can be removed or raised -->
<p:ajax update="p"/>
<f:validateLongRange minimum="1" maximum="50" />
</p:spinner>
<div class="whiteSpace"/>
<h:outputText value="Copies that will be printed: #{printerSettings.p}" id="p"/>
<h:message for="Copies" style="color:red" />
</p>
这以前可以工作,但现在没有发生验证,没有错误等。这是如何引起的,我该如何解决?
编辑
<div id="site_content">
<div id="content">
<h:body>
<h:form onsubmit="return validateForm()">
<p>
In how many minutes time would you like to have your job sent to the printer ?
<div class="whiteSpace"/>
<p:spinner id="minutes" min="0" max="1000" value="#{printerSettings.t}" size ="1">
<p:ajax update="NewTime"/>
<f:validateLongRange minimum="1" maximum="1000" />
</p:spinner>
<h:message for="minutes" style="color:red" />
<br></br>
<br></br>
The time the print job will be sent to the printer will be :
<!--<p:button actionListener="{otherBean.setTValue(printerSettings.t)}" value="Set Val" /> Currently causing an error -->
<br></br>
<h:outputText value="#{printerSettings.getNewTime()}" id="NewTime"/>
<br></br>
<br></br>
<p:commandButton type="submit" action="#{email.mail(printerSettings.t, printerSettings.p, printerSettings.paperSize, printerSettings.duplex, printerSettings.orienation, printerSettings.printer)}" onclick="Thankyou()" value="Print" />
<p:button outcome="index" value="Homepage" icon="ui-icon-home">
</p:button>
</h:form>
</h:body>
</div>
</div>
<script type="text/javascript">
function Thankyou()
{
alert("Sent to the printing holding queue, you may close this app now or carry on using this app, your work will still print out ");
//location.href = 'index.xhtml';
}
那样行吗 ?如果需要,我可以发布更多代码,正如我在评论中所说,验证似乎正在工作,这只是现在显示的错误消息
编辑
<p:commandButton type="submit" update ="minutes2 Copies2" action="#{email.mail(printerSettings.t, printerSettings.p, printerSettings.paperSize, printerSettings.duplex, printerSettings.orienation, printerSettings.printer)}" onclick="Thankyou()" value="Print" />