0

I have an item list with quantities. The quantities can be entered by the user in the inputText field, but the value should not be less than 1 or more than 99. Now a validation error should be displayed under the inputText, but this does not work. here is my code:

<ui:repeat value="#{wkHandler.books}" var="book" varStatus="status">
<h:form>
    <!-- quantity -->
    <h:inputText id="myNumberInput_#{status.index}" value="#{wkHandler.numberValues[status.index]}" binding="#{input1}">
        <f:validateLongRange minimum="1" maximum="99" />
        <!-- update every keyup -->
        <p:ajax event="keyup" delay="500" update="gesamtSumme blockToUpdate" listener="#{wkHandler.manuelQuantityChange(input1.value, status.index)}" />
    </h:inputText>
    <h:message for="myNumberInput_#{status.index}"/> <!-- not working  -->
</h:form>
</ui:repeat>

it seems to me that the id cannot be found. but why? How can I fix that? The validation works since I get this warning in the console:

Mai 31, 2023 12:40:08 PM org.apache.myfaces.lifecycle.RenderResponseExecutor execute
WARNUNG: There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered.
These unhandled FacesMessages are: 
- j_id_f:1:j_id_h:myNumberInput_: Validation error: The value is not between the expected values of 1 and 99.
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
UserXyZ
  • 3
  • 4

0 Answers0