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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:23:36+00:00 2026-05-23T23:23:36+00:00

I am using a popup where the popup is on rich model panel when

  • 0

I am using a popup where the popup is on rich model panel
when I am trying to create new value and click on save button and there is no value where required is true i get err message (like i want to !!!!) but if this person click on close (x button) the next time this pop is loaded and showmodelpanel is being called(on update mode where i try to take the city value from a jsf bean) no value is written (where there should be one !!!! this is my bug )

I want that after someone close my popup even thought he got an err massage from validation facet ‘the next time he open the pop up new values will be entered

NOTICE : the disabled face is ok but inserting the values is not (odd….)

can someone explain what is the problem (provably something about the jsf faces , how can I restore the page to his original status after validation err ? )

  <rich:modalPanel id="DefineEntityAddress" width="400" height="300"
autosized="true">
<h:graphicImage value="/images/close.png" styleClass="hidelink"
            id="DefineEntityAddressHidelink" />
        <rich:componentControl for="DefineEntityAddress"
            attachTo="DefineEntityAddressHidelink" event="onclick"
            operation="hide">

.
.
.

 <h:form>
 <t:div style="display:block;height:17px;">
                        <rich:comboBox required="true" id="suggestionBoxCity"
                            value="#{DefineEntityAddressControl.chossenCity}"
                            suggestionValues="#{DefineEntityAddressControl.allCityNames}"
                            directInputSuggestions="true" required="true"
                            disabled="#{DefineEntityAddressControl.readOnly}"
                            listStyle="text-align: right;" tabindex="12">
                            <a4j:support event="onchange" reRender="suggestionBoxStreet"></a4j:support>
                        </rich:comboBox>
                    </t:div>
                    <a4j:outputPanel ajaxRendered="true">
                        <t:message for="suggestionBoxCity" styleClass="dyna_error"></t:message>
                    </a4j:outputPanel>
                </a4j:region>


<a4j:commandButton id="save" value="#{l.save}"
            oncomplete=" closeModalPanel();"                
            reRender="hidden,saveError,saveError1,#{DefineEntityAddressControl.ok ? DefineEntityAddressControl.callinglabalTorerender : l.end_date}"
            disabled="#{DefineEntityAddressControl.toDelivery}"
            action="#{DefineEntityAddressControl.save}"
            styleClass="actionButton" />

</h:form>

</rich:modalPanel>
  • 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-23T23:23:37+00:00Added an answer on May 23, 2026 at 11:23 pm

    It is a known JSF ‘feature’. When form is submitted, components in JSF tree are updated with the submitted values. Then validation failed, so model (DefineEntityAddressControl.chossenCity, etc.) is not updated. But submitted values are still in the components tree, and JSF legally renders that values on UI (allowing user to correct that).

    Solution is to clear submitted value on ‘Close’ button click.

    /**
     * Clears all the submitted values of input components in the same form as the specified component.
     * Call this method from action listener, e.g.
     * In Java bean:
     * {@code
     * public void processCloseAction(ActionEvent e) {
     *    clearSubmittedValues(e.getComponent());
     * }
     * }
     *
     * At page:
     * {@code
     * <a4j:commandButton actionListener="#{bean.processCloseAction}"
     *                    ajaxSingle="true"
     *                    limitToList="true"
     *                    oncomplete="Richfaces.hideModalPanel('#{id}')"
     *                    value="Cancel"/>
     * }
     *
     * @param component child of the form to be cleared
     */
    public void clearSubmittedValues(UIComponent component) {
        while (component != null) {
            if (component instanceof UIForm || component instanceof UIAjaxRegion
                    || component instanceof UIModalPanel) {
                clearRegion(component);
            }
            component = component.getParent();
        }
    }
    
    public void clearRegion(UIComponent parent) {
        for (UIComponent component : parent.getChildren()) {
            if (component instanceof EditableValueHolder) {
                EditableValueHolder input = ((EditableValueHolder) component);
                input.setSubmittedValue(null);
                // The following is only needed for immediate input components
                // but it won't do any harm in other situations..
                input.setValue(null);
                input.setLocalValueSet(false);
            } else {
                clearRegion(component);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create modal popup box using jquery depending on the clicked tr
I am using a popup menu in Delphi. I want to use it in
I am using the AJAX Control Toolkit Popup Calendar Control in a datagrid. When
I am using FancyBox to generate a popup image. FancyBox (In case you are
We have implemented a popup window as a modal dialog using the IE method:
SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not borrow
I have an asp.net web page written in C#. Using some javascript I popup
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I using Richfaces 3.3 and Jsf 2. I have a tab panel with a

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.