I am currently trying to use an h:selectOneMenu to get Input from the User. When the User submits the form the user either gets to the same page again or to a different page. As long as the user always picks the first option available everything is fine, but as soon as he picks another one the component with id=selection1 is complaining: Validation error - value is not valid.
Here is the form:
<h:form styleClass="form-horizontal">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<div class="checkbox">
<label><h:selectBooleanCheckbox value="#{startBean.abstainFromItem}"></h:selectBooleanCheckbox>Bei dieser Frage enthalten</label>
</div>
</div>
</div>
<div class="form-group">
<ui:fragment rendered="#{startBean.currentItem.type != 'M_OF_N'}">
<h:outputLabel for="selection1" styleClass="col-sm-2" value="Option(en) auswählen:"/>
<div class="col-sm-8">
<h:selectOneMenu value="#{startBean.buffer[0]}" styleClass="form-control" id="selection1">
<f:converter converterId="javax.faces.Integer"/>
<ui:param name="iValue" value="0"/>
<c:forEach items="#{startBean.currentItem.options}" var="option1">
<f:selectItem itemLabel="#{option1.title}" itemValue="#{iValue}"/>
<ui:param name="iValue" value="#{iValue + 1}"/>
</c:forEach>
</h:selectOneMenu>
<h:message for="selection1"/>
</div>
</ui:fragment>
<ui:fragment rendered="#{startBean.currentItem.type == 'M_OF_N'}">
<h:outputLabel for="selection2" styleClass="col-sm-2" value="Option(en) auswählen:"/>
<div class="col-sm-8">
<h:selectManyMenu styleClass="form-control" id="selection2" value="#{startBean.buffer}">
<f:converter converterId="javax.faces.Integer"/>
<ui:param name="lValue" value="0"/>
<c:forEach items="#{startBean.currentItem.options}" var="option2">
<f:selectItem itemLabel="#{option2.title}" itemValue="#{lValue}"/>
<ui:param name="lValue" value="#{lValue + 1}"/>
</c:forEach>
</h:selectManyMenu>
</div>
</ui:fragment>
</div>
<ui:debug/>
<ui:fragment rendered="#{startBean.index lt startBean.count}">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<h:commandButton styleClass="btn btn-primary" value="Nächstes Item" action="submitvote">
<f:actionListener binding="#{startBean.nextItem()}"/>
</h:commandButton>
</div>
</div>
</ui:fragment>
<ui:fragment rendered="#{startBean.index == startBean.count}">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<h:commandButton styleClass="btn btn-primary" value="Stimmzettel abgeben" action="index">
<f:actionListener binding="#{startBean.submit()}"/>
</h:commandButton>
</div>
</div>
</ui:fragment>
</h:form>
There are various answers to similiar problems, but they all make use of the f:selectItems tag while I do not. Nor do i think i need to implement an equals method.