-1

I have a rich:popupPanel with content:

<rich:popupPanel id = "popupId">
    <h:panelGrid>
        <h:form id="formId">
           <h:panelGrid>
                // content, e.g. radiobuttons, dropdowns, panelGroups and other jsf and   richfaces components , nested components
           </h:panelGrid>
        </h:form>
    </h:panelGrid>
</rich:popupPanel>

And a link to open and rerender the form and the popup:

<a4j:commandLink actionListener="myListener();" render="popupId formId">

I have tried many values of render attribute, such as popupId or formId.

When I click the link, the popup window is being opened but I don't have javax.faces.ViewState hidden input field in the form. When I try to select some radio or to change value for dropdown (or any other action), then the first submit does nothing, because the javax.faces.ViewState is missing. After that, it reappears back in the form and the second submit and on works fine.

How is this caused and how can I solve it?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
ikos23
  • 4,879
  • 10
  • 41
  • 60
  • possible duplicate of [ action is only invoked on second click](http://stackoverflow.com/questions/10094615/a4jcomandbutton-action-is-only-invoked-on-second-click) – BalusC May 20 '13 at 16:28

1 Answers1

1

The solution is very easy. Not to ajax-render components with <h:form> within. Put all components inside and render these components !

<rich:popupPanel id="popupId">
    <h:form id="formId">
        <h:panelGrid id="panelGridId">
            // content
        </h:panelGrid>
    </h:form>  
</rich:popupPanel>

Not popupId, not formId !!!!!!!

<a4j:commandLink actionListener="someListener()" render="panelGridId" />

And then we will not lose javax.faces.ViewState id and everything will work correctly!

ikos23
  • 4,879
  • 10
  • 41
  • 60