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 6662069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:21:03+00:00 2026-05-26T02:21:03+00:00

I have a two tab page, one tab is the record list, click on

  • 0

I have a two tab page, one tab is the record list, click on the record will switch to the Edit tab, and there’s Save and Cancel buttons in the Edit tab.

Now, I click on the record #1, do some edit, and click the Cancel button. Certainly I don’t want to validate the form because it’s canceled, so I set immediate="true" on the Cancel button. Now the edit tab is closed, back to the record list. Then, I click on another record #2, the problem occurred: In the edit tab, it’s still the previous content of record #1, rather then record #2. I’ve checked the variables in debug view, the back bean for the edit form was ACTUALLY filled with record #2.

I.e., something broken after an immediate command.

(Everything had been well before I have added the validation and immediate=”true”.)

class FormBean {

    Record activeRecord;
    ...

    public void clickOnList() {
        activeRecord = loadRecord(clickIndex);
    }

    public void cancelForm() {
        activeRecord = null;
    }

}

page.xhtml:

<h:form id="main">
  ...
  <p:tab title="Edit" rendered="#{formBean.activeRecord != null}">
    ...
    <p:commandButton value="Cancel"
        actionListener="#{formBean.cancelForm}"
        update="main" async="true" immediate="true" />
  </p:tab>
</h:form>
  • 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-26T02:21:03+00:00Added an answer on May 26, 2026 at 2:21 am

    The immediate="true" doesn’t work nicely with ajax requests on the same view. It boils down to that the submitted-but-not-validated values are still there in the input components. Without ajax, a normal synchronous request/response of a subsequent form submit would silently “solve” this. But with ajax, this does not happen. The submitted values of the previous ajax request are still there in the input components. When UIInput#getSubmittedValue() doesn’t return null, it will be displayed instead, irrespective of the (changed) model value.

    Basically, when you want to stick to ajax for a cancel button, you need to exclude the inputs from being processed instead of relying on the immediate="true" (which is actually kind of a hack). In standard JSF <f:ajax> terms, you could do this with execute="@this" (which is actually the default) on the button instead of execute="@form". The PrimeFaces buttons defaults to @form, so you need to change this:

    <p:commandButton value="Cancel"
        actionListener="#{formBean.cancelForm}"
        update="main" async="true" process="@this" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tab contol with two tabs. Each one containing listviews. When the
I have two forms on my page, and when focus is set to one
I have two ASP.NET Menu controls on a page. One in my header (tabs)
I have built two control containers on a page, one is using jquery-ui tabs
I have a page with two tabs, a search-tab and a tab with a
I have two tab panels, and in each of these there is a user
I have two pages. One aspx page and the other an aspx page but
I have a page where I am trying to implement a simple two tab
In tab container let say I have two tabs [Tab1 & Tab2] Tab1 has
I'm developing an iPhone application that have a TabBarController with two tabs. Each tab

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.