This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSF and the fly likes ValueChangeListener for double values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "ValueChangeListener for double values" Watch "ValueChangeListener for double values" New topic

ValueChangeListener for double values

Mathandisto Mathandistos

Joined: Jan 25, 2011
Posts: 1


I am hoping someone will be able to assist, I am new to jsf and i'm having difficulties with valuechangelistener.

For some odd reason, it's not rendering the total field with the new value. Did I perhaps miss something?

Your assistance will be much appreciated.

in my feesCalculationEdit.xhtml I have

h:form id="feesCalculation">
<s:decorate id="squareMetersField" template="/layout/edit.xhtml">
<ui:define name="label">Square meters</ui:define>
<h:inputText id="squareMeters" value="#{feesCalculationHome.instance.squareMeters}"
<a:support event="onchange" reRender="squareMetersField,totalField" bypassUpdates="true" ajaxSingle="true"/>

<s:decorate id="totalField" template="/layout/edit.xhtml">
<ui:define name="label">Total</ui:define>
R<h:inputText id="total" value="#{}">
<a:support event="onblur" reRender="totalField" bypassUpdates="true" ajaxSingle="true"/>

and in my feesCalculationHome bean I have

Map<Double, UIComponent> UIComponent;
public void updateFeeValuesChanged(ValueChangeEvent event) {
System.out.println("A value has changed!");
Double oldSquareMeters = ((double) event.getOldValue()).doubleValue();
Double squareMeters = ((double) event.getNewValue()).doubleValue();
System.out.println("OLD squareMeters = " + oldSquareMeters);
System.out.println("squareMeters = " + squareMeters );
javax.faces.component.UIComponent total = event.getComponent().findComponent(":feesCalculation:totalField:total");

Thank you in advance
I agree. Here's the link:
subject: ValueChangeListener for double values
Similar Threads
On selectonemenu change uncheck checkbox?
problem on saving inputText values
Do I need a backing bean to get the character length of the contents in a text-area?
How to prevent values over 99inches but still allow 13.5 inches
Mutiple ComboBoxes using c:forEach