i am finishing off a web app, and want to put validation on my spinner, it should only let the user submit a value of between 1 and 50, however what i want is if a user deleted the value and for example entered 0, it to come up with a error message on the webpage informing the user that this is incorrect, the backing to the spinner has all validation, so if a value of 0 was entered, nothing would happen, but i am just looking for a way to inform the user about this, using a pop up etc
here is my code for the spinner
<h:body>
<h:form id="myForm">
<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"/>
</p:spinner>
<div class="whiteSpace"/>
<h:outputText value="Copies that will be printed: #{printerSettings.p}" id="p"/>
</p>
i have tried to add javascript validation to no success, as you can see in my other question
my question here is what is the best method of achieving my aim, and does any one have any examples i could follow ?
Thanks guys:)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…