myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Bischoff <jbisch...@klkurz.com>
Subject Re: ValueChangeListener not called
Date Fri, 06 Oct 2006 13:09:26 GMT
The valueChangeListener can not fire from your code.

 >>       <tc:selectOneChoice
 >> valueChangeListener="#{mybean.processValueChange}"
 >> onchange="submit();" value="">
 >>             <f:selectItems value="#{mybean.featureValue_1}" />
 >>       </tc:selectOneChoice>

Look, you have hard-coded the value! So how can the value ever change?

And your original example code didn't even have a value attribute defined!

Notice it's called *value*ChangeListener, not selectionChangeListener. :)

Make the selectOneChoice's "value" attribute a value-binding expression 
that references a String property on some backing-bean. When you select 
something in the combo box, it will call the setter for that property, 
using the itemValue from the selectItem. It should also fire a 
valueChange event.

Hope this helps.

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.


Gerald Müllan wrote:
> Hi,
> 
> have you put any message/messages-tag into the page, to see if there
> comes some message from the jsf environment?
> 
> Also set the "value" attribute of selectOneChoice to a value in the
> managed bean., like "Nabe_Name" or "Kette_Name". Maybe thats the
> problem.
> 
> cheers,
> 
> Gerald
> 
> On 10/6/06, Peter Rabing <peter.rabing@gmx.de> wrote:
>> Hi,
>>
>> "submit() " or "submit();" makes no difference, the form is submitted 
>> when a value in the combo is
>> selected, sorry that I wasn't clear on this in my first post.
>>
>> My Bean does implement
>>
>> public void processValueChange(javax.faces.event.ValueChangeEvent 
>> valueChangeEvent) {
>>
>>     log.fine("*************\n**********\nreceived value change event 
>> "+valueChangeEvent);
>>
>>     throw new IllegalStateException("************ This can't be true 
>> **********");
>> }
>>
>> And the form is rendered in the HTML, too.
>>
>> The bean is called to retrieve the values of the combo:
>>
>> public SelectItem[] getFeatureValue_1() {
>>         SelectItem [] items = new SelectItem [2];
>>
>>         items[0] = new SelectItem( "Nabe_Name",     "Nabenschaltung", 
>> "a desc");
>>         items[1] = new SelectItem( "Kette_Name",    "Kettenschaltung", 
>> "a desc");
>>
>>         return items;
>> }
>>
>> The whole page is fairly stripped down now, but it still doesn' work:
>>
>> <f:view >
>>   <tc:page label="Page Title" id="page"  >
>>     <tc:panel>
>>       <f:facet name="layout">
>>         <tc:gridLayout border="0" rows="20px;fixed;*" />
>>       </f:facet>
>>
>>       <tc:out escape="false" value="Statisch" />
>>
>>       <tc:selectOneChoice 
>> valueChangeListener="#{mybean.processValueChange}" 
>> onchange="submit();" value="">
>>             <f:selectItems value="#{mybean.featureValue_1}" />
>>       </tc:selectOneChoice>
>>
>>      </tc:panel>
>>   </tc:page>
>> </f:view>
>>
>>
>> Any other ideas ?
>>
>> Thank you very much,
>>
>> Peter
>>
>> >
>> > Does your bean implement the method   public void
>> > processValueChange(javax.faces.event.ValueChangeEvent event) {...} ?
>> >
>> > and
>> >
>> > Is the form rendered in the HTML output ? May be missing <h:form> ?
>> >
>> > regards
>> >
>> > Marco
>> >
>> > --
>> > http://www.lenses-price-comparison.com
>> > http://www.perfume-price-comparison.com
>> >
>> >
>> >
>> > Peter Rabing schrieb:
>> > > Hi,
>> > >
>> > > I am trying to install a changelistener on a combo box. But 
>> unfortunately, nothing happens, no listener is called.
>> > > The box is rendered correctly, and has the correct values on click 
>> it is submitted, but the listener is never called and no exception 
>> occurs:
>> > >
>> > >  <tc:selectOneChoice 
>> valueChangeListener="#{mybean.processValueChange}" onchange="submit() ">
>> > >     <f:selectItems value="#{mybean.featureValue_1}" />
>> > >  </tc:selectOneChoice>
>> > >
>> > > My Bean implements the ValueChangeListener interface.
>> > >
>> > > I guess I am missing something essential here ..
>> > >
>> > > Thanks for your help.
>> > >
>> > > Peter
>> > >
>> -- 
>> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
>> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>>
> 
> 



Mime
View raw message