Strange behaviour of RichFaces a4j.jsFunction <p>my problem is simple. Im using RichFaces 4.3.2 final and making programatically dynamic panelMenu. I managed to do that and use setOnClick("menuGroupAction('"+labelOfGroup+"')") to each UIPanelMenuGroup and UIPanelMenuItem. labelOfGroup varies depending on items from DB. menuGroupAction is a4j:jsAction used as:</p> <pre><code>&lt;h:form&gt; &lt;a4j:jsFunction name="menuGroupAction" actionListener="#{leftMenu.updateCurrent}" render=":contentForm:test" &gt; &lt;a4j:param name="param1" /&gt; &lt;/a4j:jsFunction&gt; &lt;/h:form&gt; </code></pre> <p>Problem is when i click on the TOP submenu <code>param1</code> is changing as expected, but when i try to click on any inner submenu onclick is fired BUT with <code>param1</code> of its top menu, even though the inner submenu has onclick="menuGroupAction('itslabel')". Any idea why is it happening? Im checking which parametter was posted with</p> <blockquote> <p>String param1 = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("param1");</p> </blockquote> <p>Another thing, when clicked on UIMenuItem in any submenu there are actually TWO calls of menuGroupAction, one with param of Top menu and another with correct param of menuItem. Thanks for response and sorry for bad english.</p> <p>UPDATE</p> <p>heres how i use rich:panelMenu on page</p> <pre><code>&lt;h:form&gt; &lt;rich:panelMenu binding="#{leftMenu.menuCategories}" groupMode="ajax" itemMode="ajax" bubbleSelection="false" &gt;&lt;/rich:panelMenu&gt; &lt;/h:form&gt; </code></pre> <p>heres getter for panelMenu model menuCategories</p> <pre><code> /** * @return the menuCategories */ public UIPanelMenu getMenuCategories() { if(menuCategories == null){ menuCategories = menuService.createCategoriesUIPanelMenu(); } return menuCategories; } </code></pre> <p>and heres how i create UIPanelMenu</p> <pre><code>public UIPanelMenu createCategoriesUIPanelMenu(){ List&lt;Category&gt; allTopCategories = catOper.getAllTopCategories(); int menulevel = 1; sortByOrderOfCategories(allTopCategories); UIPanelMenu categories = new UIPanelMenu(); categories.setTopGroupClass("button"); for (Category category : allTopCategories) { UIPanelMenuGroup topMenuCategory = new UIPanelMenuGroup(); topMenuCategory.setLabel(category.getName()); topMenuCategory.setOnclick("menuGroupAction('"+category.getName()+"')"); rekursiveCategoriesMenuGroupSetter(topMenuCategory,category,menulevel); categories.getChildren().add(topMenuCategory); } return categories; } private UIPanelMenuGroup rekursiveCategoriesMenuGroupSetter(UIPanelMenuGroup parent, Category category, int menuLevel){ int level = menuLevel+1; List&lt;Category&gt; allTopCategories = (List&lt;Category&gt;) category.getCategoryCollection(); sortByOrderOfCategories(allTopCategories); for (Category child : allTopCategories) { if(!child.getCategoryCollection().isEmpty()){ UIPanelMenuGroup subGroup = new UIPanelMenuGroup(); subGroup.setLabel(child.getName()); subGroup.setLeftIconClass("menuLevel"+level); subGroup.setOnclick("menuGroupAction('"+child.getName()+"')"); parent.getChildren().add(subGroup); rekursiveCategoriesMenuGroupSetter(subGroup,child,level); } else{ UIPanelMenuItem item = new UIPanelMenuItem(); item.setLabel(child.getName()); item.setLeftIconClass("menuLevel"+level); item.setOnclick("menuGroupAction('"+child.getName()+"')"); parent.getChildren().add(item); } } return parent; } </code></pre> <p>UPDATE</p> <p>Strange i tried it on clean page and come to some interesting news. When theres set default groupMode aka 'client' that when clicked on some inner group there are TWO calls of that action one with top submenu param and one with correct param of innersubmenu (same with server), which is a little step forward i suppose in comparison to calling ONLY with top submenu.</p>