Why can I not add an action to a pr:menu menuitem?

Locked
RElliott
Posts: 94
Joined: 07 Feb 2014, 00:39

30 Jun 2015, 06:00

I added the following code to my Rio template menu:

Code: Select all

<form id="menu-form">
    <pr:menu id="rm_test">
        <p:menuitem
            id="rm_logout"
            value="Logout"
            icon="icon-locked57 Fs16"
            action="#{elisSession.logout}"
            ajax="false" />
    </pr:menu>
</form>
Unfortunately, when I accessed my welcome page, I received the following error:

Code: Select all

2015-06-29T22:51:24.534-0500|Severe: Error Rendering View[/welcome.xhtml]
javax.faces.FacesException: MenuItem must be inside a form element
	at org.primefaces.rio.component.menu.RioMenuRenderer.encodeMenuItem(RioMenuRenderer.java:198)
	at org.primefaces.rio.component.menu.RioMenuRenderer.encodeElement(RioMenuRenderer.java:72)
	at org.primefaces.rio.component.menu.RioMenuRenderer.encodeElements(RioMenuRenderer.java:51)
	at org.primefaces.rio.component.menu.RioMenuRenderer.encodeMarkup(RioMenuRenderer.java:41)
	at org.primefaces.component.menu.BaseMenuRenderer.encodeEnd(BaseMenuRenderer.java:113)
PrimeFaces 7.0.1, Glassfish 5.1.0, Oracle JDK 8, Eclipse 2016-02

mert.sincan
Posts: 4316
Joined: 29 Jun 2013, 12:38

30 Jun 2015, 08:13

Please try with "<h:form>".

RElliott
Posts: 94
Joined: 07 Feb 2014, 00:39

30 Jun 2015, 10:47

That was too easy. Thanks!
PrimeFaces 7.0.1, Glassfish 5.1.0, Oracle JDK 8, Eclipse 2016-02

mert.sincan
Posts: 4316
Joined: 29 Jun 2013, 12:38

30 Jun 2015, 16:21

Glad to hear, thanks!

Locked

Return to “Rio”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest