ユーザーがフォームフィールドのセット(名、姓、および電子メール)をフォームに動的に追加および削除できるフォームがあります。その部分は正常に機能していますが、もちろん、これらのフィールドで検証が必要です。最初のフィールドセットだけでフォームを送信すると、うまく機能し、各フィールドで検証が行われます。次のフィールドのセットを追加して送信すると、最初のセットと2番目のフィールドの1つだけに検証メッセージが表示されます。何が起こっているのかよくわかりませんが、.xhtml
ファイルは次のようになります。
<h:form>
<ui:repeat var="i" value="#{bean.list}">
<h:panelGrid columns="5" rowClasses="newRoow">
<h:inputText id="firstName" value="#{i.first_name}"
required="true" requiredMessage="Please enter a First Name" />
<h:inputText id="lastName" value="#{i.first_name}"
required="true" requiredMessage="Please enter a LastName" />
<h:inputText id="email" value="#{i.first_name}"
required="true" requiredMessage="Please enter an Email Address"> />
<h:commandButton value="+">
<f:ajax event="click" render="@form"
listener="#{bean.addItemFromList}" />
</h:commandButton>
<h:commandButton value="-">
<f:ajax event="click" render="@form"
listener="#{bean.removeItemFromList(i)}" />
</h:commandButton>
<h:message for="firstName" errorClass="warnings" showSummary="true" />
<h:message for="lastName" errorClass="warnings" showSummary="true" />
<h:message for="email" errorClass="warnings" showSummary="true" />
</h:panelGrid>
</ui:repeat>
<h:commandButton value="Submit"
actionListener="#{bean.someFunction}"
action="nextPage" />
</h:form>
なぜこれが失敗するのかについてのアイデアはありますか?
最初のフィールドセットを使用すると、次のようにうまく機能します。http: //i.imgur.com/uMrrO.png検証は各フィールドの下にあります。
2番目以降のフィールドセットでは、次のようになります。http: //i.imgur.com/FeZ3T.pngまたは、追加ボタンを押すたびにもう1つのフィールドを検証するように見えるため、少し異なります。