Actually, the immediate attribute does not actually skip validation.  See this 
wiki page for a deeper explanation.

http://wiki.apache.org/myfaces/How_The_Immediate_Attribute_Works


>-----Original Message-----
>From: John Holland [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, January 4, 2006 05:22 PM
>To: 'MyFaces Discussion'
>Subject: update other component values via an immediate action
>
>Is it possible to update component values using an immediate action (no
>validation)?
>
> 
>
>Here's the situation, I have a list of shifts that a user may select
>from. When they select a shift and hit the load button it updates the
>rest of the model with that shifts data.  The button is immediate
>because I don't want any of the other data to be validated yet.  The
>load button's code is below.
>
> 
>
><h:commandButton type="submit"
>
>                 value="#{msgs.loadButton}"
>
>                 immediate="true"
>
>     actionListener="#{onCallAssignmentBackerBean.loadShift}"
>
>                 styleClass="button"/> 
>
> 
>
> 
>
>The problem is that the new values don't seem to get displayed in the
>resulting page the old ones are redisplayed instead.  Here's the
>actionListener code I use to update my backing bean.
>
> 
>
>    /**
>
>     * An immediate action, so I need to manually set the new shift.
>
>     */
>
>            public void loadShift(ActionEvent event) {
>
>                        FacesContext context =
>FacesContext.getCurrentInstance();
>
>                        UIViewRoot viewRoot = context.getViewRoot();
>
>                        
>
>                        UIInput shiftComponent = (UIInput)
>viewRoot.findComponent("mainForm:selectShiftBox");
>
>                        
>
>                        if(null != shiftComponent.getSubmittedValue()) {
>
>
>                                   try {
>
>                                               setSelectedShiftId(new
>Long((String) shiftComponent.getSubmittedValue()));
>
>                                   } catch (ClassCastException e) {
>
>                                               //swallow it up... mmmm.
>We don't want this error bubbling to the top.
>
>                                   }
>
>                        }
>
>                        
>
>            if(selectedShiftId != null) {
>
>                        
>
>                        ShiftBean shift =
>onCallServices.getShift(selectedShiftId);
>
>                        
>
>                        setEndTime(shift.getEndDate());
>
>                        setStartTime(shift.getStartDate());
>
>                        setPriority(shift.getPriority());
>
>                        setRemark(shift.getRemark());
>
>                        
>
>            }
>
>    }
>
>All of the other components values are drawn from this backing bean
>
> 
>
>The updates to the backing bean happen correctly and if you do a manual
>refresh of the page the new values appear.   
>
> 
>
>It seems to me that the getters aren't being called for the other
>components when the load button is activated.
>
> 
>
>Anybody have any idea what I'm doing wrong here?  Am I using the
>immediate attribute correctly?
>
> 
>
>Thanks,
>
>John
>
> 
>
>


Reply via email to