myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Weber" <v.we...@inexso.de>
Subject Re: [tobago] <tc:SelectOneListBox> :Issue with ValueChangeEvent & Validator
Date Thu, 21 Feb 2008 14:59:29 GMT
than it should work!

can you add a tc:messages tag inside the orderPanel to ensure there
are no conversion/validation errors.

2008/2/21, Raj .G. Narasimhan <gopalnrg@gmail.com>:
> Thanks Volker, for the reply!
>
> The SelectOneListBox with the facet, is within the rendered panel
> (orderPanel which encloses both this selectListOneBox component, as well as
> the 'orderDetailPanel').  Hence, I expected the value of SelectOneListBox,
> to be processed. And, it's not.
>
> I will  try with the other two options....
>
> Appreciate it!
>
> tx,
> -R
>
>
>
> <tc:panel id="orderPanel">
> ....
> ...
> <tc:box label="#{rsrcBundle.order_orderListLabel}">
>          <f:facet name="layout">
>             <tc:gridLayout rows="*" columns="*" margin="2px" />
>         </f:facet>
>         <tc:selectOneListbox value="#{orderPanelController.order}"
>
> valueChangeListener="#{orderPanelController.showInDetail}"
>
> validator="#{orderPanelController.validateListSelection}">
>             <f:selectItems value="#{orderPanelController.orders}" />
>              <f:converter converterId="deviceOrderId" />
>
>             <f:facet name="click">
>                 <tc:command action="#{orderPanelController.returnNull}">
>                      <tc:attribute value=":cdbmainpage:orderPanel"
>                         name="renderedPartially" />
>                 </tc:command>
>             </f:facet>
>  <%-- I tired the same command with 'change' facet' also %>
>         </tc:selectOneListbox>
>
>     </tc:box>
>
> <tc:panel id="orderDetailPanel">
>
>
>  On Thu, Feb 21, 2008 at 3:22 AM, Volker Weber <v.weber@inexso.de> wrote:
> > Hi Raj,
> >
> > if i interpret your code snippet correct,
> >
> > the selectOneListbox with the click/change facet is NOT inside the
> > partially rendered panel. This is the problem, only the content of the
> > partiallyRendered component is processed on the server.
> >
> > you have two(tree) choices:
> > 1. include the listbox into the renderedPartially scope.
> > 2. invoke the processing of listbox lifecycle in your action.
> >    UIComponent listbox = facesContext.getViewRoot().findComponent(<id
> > of listbox>);
> >    listbox.processDecodes(facesContect);
> >    listbox.processValidations(facesContect);
> >    listbox.processUpdates(facesContect);
> >
> > 3.(experimental) use 1.1-SNAPSHOT version.
> >  you can declare full page to be submitted (and processed) partially and
> >  in your action method remove the page and add orderPanel from/to the
> > partially
> >  component list.
> >
> >
> > Regards,
> >    Volker
> >
> > 2008/2/21, Raj .G. Narasimhan <gopalnrg@gmail.com>:
> >
> >
> >
> > > I am trying to show the details of 'SelectItem' object of
> SelectOneListBox
> > > on a set of Input fields. Problem that I am facing is, whenever the page
> is
> > > rendered partially, it always returns the 'value' of SelectOneListBox as
> > > null.  I have tried using both 'change' and 'click' facets, and both of
> them
> > > are not giving the desired results.
> > >
> > > Here's the scenario, in little detail:
> > >
> > > When I use, 'click' facet, and tried to select different list items:
> > >
> > > ** In the valueChangeEvent, everytime it's retaining the initially set
> value
> > > (First item of List box, which I set when I render the panel for the
> first
> > > time) .
> > >
> > > ** getValue() of the source component in the valueChange event, is
> > > supposedly returning the binding value, if the current value is null.
> And, I
> > > guess, this is the reason, it retains the old value, if the current
> > > localvalue is null.
> > >
> > > ** After this listerner call, it tries to set the value of the
> > > SelectOneListBox's bound value as null, and this results in NPException,
> as
> > > the 'DetailPanel's fields are this object's properties.
> > >
> > >  ** I tried intercepting with a Validator - Surprisingly, this is not
> called
> > > at all...
> > >
> > >
> > > When I use "Change" facet and tried to select different list items:
> > > ** ValueChangeEvent does not occur at all
> > >  **Agreeably, 'change' facet's command is also not called
> > > **No validator call is made
> > >
> > > Here's the code snippet:
> > > <tc:panel id="orderPanel">
> > > ....
> > > ...
> > > <tc:box label="#{rsrcBundle.order_orderListLabel}">
> > >          <f:facet name="layout">
> > >             <tc:gridLayout rows="*" columns="*" margin="2px" />
> > >         </f:facet>
> > >         <tc:selectOneListbox value="#{orderPanelController.order}"
> > >
> > >
> valueChangeListener="#{orderPanelController.showInDetail}"
> > >
> > >
> validator="#{orderPanelController.validateListSelection}">
> > >             <f:selectItems value="#{orderPanelController.orders}" />
> > >              <f:converter converterId="deviceOrderId" />
> > >
> > >             <f:facet name="click">
> > >                 <tc:command action="#{orderPanelController.returnNull}">
> > >                      <tc:attribute value=":cdbmainpage:orderPanel"
> > >                         name="renderedPartially" />
> > >                 </tc:command>
> > >             </f:facet>
> > >  <%-- I tired the same command with 'change' facet' also %>
> > >         </tc:selectOneListbox>
> > >
> > >     </tc:box>
> > >
> > > <tc:panel id="orderDetailPanel">
> > > ....
> > > ..
> > >
> > > OrderPanelController:
> > > public void showInDetail(ValueChangeEvent valChangeEvent) {
> > >         UISelectOne select =
> > > (UISelectOne)valChangeEvent.getComponent();
> > >         if(select.getValue() == null){
> > >             LOG.finer("Value is null");
> > >              return;
> > >         }
> > >         order = (DeviceOrder) select.getValue();
> > >         LOG.finer("Selected Order: "+select.getValue());
> > >         return;
> > >     }
> > >
> > > public void validateListSelection(FacesContext context,
> > > UIComponent component, Object value) throws ValidatorException {
> > >          if (value == null) {
> > >             System.out.println("List validation:Came here : Value is
> null");
> > >             return;
> > >         }
> > >         order = (DeviceOrder) value;
> > >         LOG.finer("Selected order in validation: "+order);
> > >      }
> > >
> > > Appreciate your help!
> > >
> > > --
> > > Thanks,
> > >
> > > Raj .G. Narasimhan
> >
> >
> > --
> > inexso - information exchange solutions GmbH
> > Bismarckstra├če 13      | 26122 Oldenburg
> > Tel.: +49 441 4082 356 |
> > FAX:  +49 441 4082 355 | www.inexso.de
> >
>
>
>
> --
> Thanks,
>
> Raj .G. Narasimhan


-- 
inexso - information exchange solutions GmbH
Bismarckstra├če 13      | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX:  +49 441 4082 355 | www.inexso.de
Mime
View raw message