It would be interesting to see whether reversing the order of your
buttons results in the reverse outcome.  In other words, if you specify:

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

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

then it would be interesting to see if that makes the update action
inoperable.  If that is the case, then something is being rendered even
for the "unrendered" button that is somehow messing up how the page gets
submitted for the "rendered" button.

Just a wild guess, though!

- Brendan

-----Original Message-----
From: Rick Reumann [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 09, 2005 1:58 PM
To: myFaces
Subject: 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

Reply via email to