You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rick Reumann <r...@reumann.net> on 2005/09/09 20:58:14 UTC

understanding the impact of 'rendered'

I am trying to use the rendered attribute to decide whether to display 
an "insert" button or a "save" button (in reality they will end up both 
saying just save, but the action associated with them is different). 
Here is how I have the buttons set up:

<h:commandButton type="submit" id="insert" value="INSERT THIS EMPLOYEE" 
action="#{employeeAction.insertAction}" rendered="#{not 
employeeAction.editMode}"/>

<h:commandButton type="submit" id="update" value="#{msgs.save}" 
action="#{employeeAction.updateAction}" 
rendered="#{employeeAction.editMode}"/>

The buttons render exactly as expected - Insert button shows up when 
it's an insert being done, save being shown when it's an update. The 
poblem is I have no idea why the "insertAction" method is not firing 
when I use the rendered attribute! If I remove rendered so that I have...

<h:commandButton type="submit" id="insert" value="INSERT THIS EMPLOYEE" 
action="#{employeeAction.insertAction}" />

inertAction will fire just fine.

What has me more stumped is that the updateAction *does* work fine with 
the rendered attribute. What is causing the insertAction to be messed up 
when I use 'rendered' ?

-- 
Rick