Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9229355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:33:03+00:00 2026-06-18T05:33:03+00:00

I have a form which the user can dynamically add and remove a set

  • 0

I have a form which the user can dynamically add and remove a set of form fields (first name, last name, and email) from the form. That part is working fine, but of course I need some validation on those fields, and if I submit the form with just the first set of fields it works great, and I get validation on each field. Once I add the next set of fields and submit I get validation messages on the first set and only one field of the second. I am not really sure what is going on, but here is how .xhtml file looks:

<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>

Any ideas as to why this would be failing?

With the first field set it is working great as you can see here: https://i.stack.imgur.com/P6mOv.png The validation is below each field.

With the second and following field sets it looks like this: https://i.stack.imgur.com/kZDHt.png or a bit different because it seems to validate one more field every time I press the add button.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:33:04+00:00Added an answer on June 18, 2026 at 5:33 am

    I later figured out that this wasn’t a problem with the code/markup I had written for this problem, but instead from a .js file that was included. This .js had some code in it that was messing with all elements with a class="warnings" which is generated from the <h:messages /> tags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form where the user can dynamically add fields (clone and increasing
I have a HTML form which allows a user to add rows ad hoc
I have a jsp form validate.jsp which contains 2 text fields where user enters
I have a form for a 'user profile' with the following fields: <form> First
I have a content management system in which a user can dynamically create an
I have a form which have many check boxes in it. User will check
I have created a PHP form which requires the user to select a postcode
I have an HTML form which, when submitted by the user, will call a
I have a form with a textfield element which when a user starts typing
I have a web form where I have a textbox in which the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.