Does it work if you remove the immediate="true" attribute from the
selectOneRadio (see this docs to see if you really need it [1]), and
remove the facesContext.renderResponse() line (not needed).

Let's see!

Bruno

[1] http://wiki.apache.org/myfaces/How_The_Immediate_Attribute_Works

On 6/13/06, Meghana <[EMAIL PROTECTED]> wrote:
I am sorry I should have included my code snippet before itself.
Here we go!

            <h:outputText value="#{Message.hardware_type}" />
            <h:selectOneRadio value="#{ServiceBean.hardwareType}"
onclick="submit()" immediate="true"
valueChangeListener="#{ServiceBean.hardwareTypeChanged}">
                <f:selectItems value="#{ServiceBean.HWTypes}"/>
            </h:selectOneRadio>

public void hardwareTypeChanged(ValueChangeEvent event)
throws SQLException, Exception{
        FacesContext context = FacesContext.getCurrentInstance();
        String prevCategorySelected = (String)event.getOldValue();
        String newCategorySelected = (String)event.getNewValue();

if(!newCategorySelected.equalsIgnoreCase(prevCategorySelected)){
            // Value changed. Change the drop down values.
             if(newCategorySelected.equals("Desktop")){
                desktopSelected = true;
                debug("Setting desktopSelected field to:
"+isDesktopSelected());
            }
            else if(newCategorySelected.equals("Laptop")){
                laptopSelected = true;
                debug("Setting laptopSelected field to:
"+isLaptopSelected()+" Laptop Type: "+laptopType);
            }
            context.renderResponse();
             }
        }
 }

Based on what  hardware type is selected Desktop items/laptop items are
displayed.
The code for that is
<h:outputText value="#{Message.desktop_type}"
rendered="#{ServiceBean.desktopSelected}"/>
            <h:panelGroup rendered="#{ServiceBean.desktopSelected}">
                <h:selectOneRadio value="#{ServiceBean.desktopType}"
id="desktop_type">
                    <f:selectItem itemValue="Standard User Desktop"
itemLabel="Standard User Desktop" />
                    <f:selectItem itemValue="Non User Desktop"
itemLabel="Non User Desktop" />
                </h:selectOneRadio>
                <h:message styleClass="error" for="desktop_type"/>
            </h:panelGroup>
            <h:outputText value="#{Message.laptop_type}"
rendered="#{ServiceBean.laptopSelected}"/>
            <h:panelGroup rendered="#{ServiceBean.laptopSelected}">
                <h:selectOneRadio value="#{ServiceBean.laptopType}"
id="laptop_type">
                    <f:selectItem itemValue="Standard User Laptop"
itemLabel="Standard User Laptop" />
                    <f:selectItem itemValue="Power User Laptop"
itemLabel="Power User Laptop" />
                </h:selectOneRadio>
                <h:message styleClass="error" for="laptop_type"/>
            </h:panelGroup>
            <h:outputText value="#{Message.docking_station}"
rendered="#{ServiceBean.laptopSelected}"/>
            <h:panelGroup rendered="#{ServiceBean.laptopSelected}">
                <h:selectOneRadio value="#{ServiceBean.dockingStation}"
id="docking_station">
                    <f:selectItem itemValue="Yes" itemLabel="Yes" />
                    <f:selectItem itemValue="No" itemLabel="No" />
                </h:selectOneRadio>
                <h:message styleClass="error" for="docking_station"/>
            </h:panelGroup>
            <h:outputText value="#{Message.wireless_access}"
rendered="#{ServiceBean.laptopSelected}"/>
            <h:panelGroup rendered="#{ServiceBean.laptopSelected}">
                <h:selectOneRadio value="#{ServiceBean.wirelessAccess}"
id="wireless_access">
                    <f:selectItem itemValue="Yes" itemLabel="Yes" />
                    <f:selectItem itemValue="No" itemLabel="No" />
                </h:selectOneRadio>
                <h:message styleClass="error" for="wireless_access"/>
            </h:panelGroup>



Bruno Aranda <[EMAIL PROTECTED]> wrote:

 And what about the "immediate" attributes? Are you using them? Can you
show an snippet of your code?

Bruno

On 6/13/06, Meghana wrote:
> Its already in session scope :-(
>
>
> Bruno Aranda wrote:
>
> Could you try if that works if your bean is in session scope?
>
> Bruno
>
> On 6/13/06, Meghana wrote:
> > Hi,
> > I have a form in which the displayed input fields change based on a
radio
> > button field. When ever the field value is changed a corresponding
> > valuechangelistener method is called and then the new set of input
fields
> > are displayed. But the values entered for those conditionally rendered
> > fields are not retaining values in the backing bean. They are all null.
> I've
> > been banging my head over this for quite a while.
> > Any ideas please!
> >
> > Thanks a lot,
> > -M
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com




 __________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Reply via email to