JSF Page does not submit when onclick javascript is added to menu item?
- by Padmarag
I show some detail using popup windows. I want to close those when the user clicks on sign-out link. I have a JavaScript function that'll close the windows.
The sign-out link is rendered using Navigation MenuModel. The definition in faces-config is as below -
<managed-bean>
<managed-bean-name>signoutNavigation</managed-bean-name>
<managed-bean-class>com.xxx.xxx.framework.NavigationItem</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
<managed-property>
<property-name>label</property-name>
<value>Sign Out</value>
</managed-property>
<managed-property>
<property-name>viewId</property-name>
<value>/signout.jsp</value>
</managed-property>
<managed-property>
<property-name>outcome</property-name>
<value>signout</value>
</managed-property>
<managed-property>
<property-name>onclick</property-name>
<value>closeOrderWindows()</value>
</managed-property>
</managed-bean>
The problem is when I use the "onclick" property on managed-bean, the page doesn't submit to "signout.jsp" and remains on same page.
When I remove/comment the "onclick" part, the page gets submitted properly.
I use MyFaces Trinidad.