Richfaces 4 a4j:commandLink action not firing in rich:popupPanel
Asked Answered
K

3

5

I seem to be having a problem where I have an a4j:commandLink on a rich:popupPanel but the action is not firing. The xhtml looks as follows:

<rich:popupPanel id="rate-panel" modal="true" height="444" width="780" top="60" show="false" onmaskclick="#{rich:component('rate-panel')}.hide()" styleClass="cs-modal">
  /**Some html here**/    
  <a4j:commandLink immediate="false" action="#{venueScore.up}" render="rate-panel" styleClass="rate love">
    <span>Love it</span>
  </a4j:commandLink>    
  /**Some more html here**/    
</rich:popupPanel>

And the managed bean looks as follows:

@Named("venueScore")
@ViewScoped
public class VenueScoreManager extends BaseManager implements Serializable {
  public void up() {
    System.out.println("TEST");
    //Do something
  }
}

I have made the managed bean @ViewScoped.

I have also tried adding an <h:form> around the commandLink however, this does even less than without it. I actually think that is because the commandLink is inside the <h:form> in which the link that opened the popupPanel sits.

Anyway, can someone please point me in the direction of why the action not fire?

Kuehl answered 1/8, 2011 at 19:38 Comment(0)
K
8

Ok, so I fixed it myself. After screwing around I worked out that I just need to add an <a4j:region> around the content in the <rich:popupPanel>. So now the xhtml looks something like this:

<rich:popupPanel id="rate-panel" modal="true" height="444" width="780" top="60" show="false" onmaskclick="#{rich:component('rate-panel')}.hide()" styleClass="cs-modal">
  <a4j:region id="panel-region">
    /**Some html here**/    
    <a4j:commandLink immediate="false" action="#{venueScore.up}" render="panel-region" styleClass="rate love">
      <span>Love it</span>
    </a4j:commandLink>    
    /**Some more html here**/    
  </a4j:region>
</rich:popupPanel>
Kuehl answered 2/8, 2011 at 7:17 Comment(2)
You cannot believe how much time i spent trying to find this answer! How did you reach this solution ?Cheremkhovo
@AmrH.AbdelMajeed - I probably spent just as much time as you. Trial and error in the end I think solved it ;)Kuehl
A
1

I had the same problem, a4j:commandLink only worked after first click.... put the poppanel inside a form and add domElementAttachment...

<h:form id="myform">
    <rich:popupPanel id="pop" domElementAttachment="form">
        ...
        <a4j:commandLink />
        ...
    </rich:popupPanel>
</h:form>
Astroid answered 12/7, 2014 at 16:15 Comment(0)
H
0

I know that it's an old question but as I had exactly the same problem, I spent a lot of time before fixing it, maybe it will help someone else. First, I tried the solution proposed above but it did not worked. Finally, I found this thread: Issues closing rich:popupPanel via show condition, RF 4.0

And I added the domElement attribute to my popup:

<rich:popupPanel 
id="newMailPopup" 
**domElementAttachment="form"** 
...>

And now, my a4j:commandLink works perfectly :-)

Hand answered 1/8, 2013 at 8:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.