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

  • SEARCH
  • Home
  • 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 6790589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:44:35+00:00 2026-05-26T17:44:35+00:00

I have a JSF2 application and a page with the following code: <h:inputText id=someInput

  • 0

I have a JSF2 application and a page with the following code:

<h:inputText id="someInput" required="true" />

<p:outputPanel id="itemsPanel">
    <ui:repeat var="i" value="#{myBean.itemIndices}" id="items">
        <h:inputText 
            id="itemInput" 
            value="#{myBean.dataItems[i]}" 
            />
        <h:panelGroup 
            layout="block" 
            styleClass="clear" 
            rendered="#{((i+1) % 10 == 0)}" 
            />
    </ui:repeat>
</p:outputPanel>
<br/>
<p:commandButton
    classStyle="btn" 
    value="Add Row"
    actionListener="#{myBean.increaseItemsCount}" 
    update="itemsPanel" 
    immediate="false"
    ajax="true"
    />

The ui:repeat is dynamically rendering a number if text boxes depending on the itemIndices and dataItems properties. The “Add Row” button calls a method that will dynamically increase the number of itemIndices and dataItems, therefore additional text inputs appear.

The current code will not work if there is no value in the text box someInput, because the AJAX request also validates the form and validation fails. Pressing the button in this case has no visual effect, not even feedback for the user that validation did not pass (because I update itemsPanel only).

If I change the button to have immediate="true", then the validation issue is no more. Unfortunately, I want to be able to restore the values of the dynamic input fields that the user might have changed prior adding the new row. The immediate="true" attribute causes the form not to be submitted to the server, therefore the user-entered data will not be persisted.

A possible solution to this could be to add process="all dynamic input ids csv" attribute to the command button and set the immediate attribute back to true. This will cause the server to validate only the inputs specified in the process attribute and they will be persisted. The problem here is that these input ids are dynamically generated by JSF and I cannot come up with a proper way to get them as a CSV. I would also not prefer a solution for dynamically generating ids in myBean relying on assumptions of how JSF would output them.

All suggestions will be greatly appreciated.

  • 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-05-26T17:44:36+00:00Added an answer on May 26, 2026 at 5:44 pm

    You could use process="itemsPanel".

    <p:commandButton
        classStyle="btn" 
        value="Add Row"
        actionListener="#{myBean.increaseItemsCount}" 
        process="itemsPanel" 
        update="itemsPanel" 
        ajax="true"
        />
    

    You should only move the command button into <h:outputPanel id="itemsPanel">.

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

Sidebar

Related Questions

I'm working in a jsf2 application and I have a problem with the page
I have a problem with redirecting a page in my JSF application. My navigation
My JSF2 application is fully internationalized, using a ResourceBundle. Now i have a lot
I have a JSF2 application that uses Spring 3.0. I have a bean that
I have simple JSF2 application running on glashfish 3.1. I want to add a
If I have a request scope bean on a page in JSF2....how do I
I am using JSF2.0 with Richfaces 4.0.0.Final for a web application. I have a
I'm using RichFaces on my JSF2 application, and I need a way to have
I am running an application using JSF2.0 and Primefaces 2.2RC2 I have run the
In my JSF2 application, I have Clear button, which is supposed to clear all

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.