You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "CONNER, BRENDAN (SBCSI)" <bc...@sbc.com> on 2005/07/08 18:27:20 UTC

valueChangeListener Question

Is there a way to revert the value of a component back to its old value
in a valueChangeListener?  I see that the valueChangeListener has access
to both the old and new values.

In particular, I'm looking at the inputCalendar component, and I want to
implement an application rule like "only future dates are allowed"
(similar to a rule that would be implemented on an airline reservation
system).  Ideally, I'd like the inputCalendar to only display links on
future dates with this rule, but, as an alternative, I was thinking I
might be able to specify a valueChangeListener for this component which
compares the selected date to the current date and queues a an error
message if the selected date is not in the future.  I tried this out,
and it works (i.e., my valueChangeListener successfully queues an error
message if the date is not in the future), except that the invalid date
still ends up being selected.  I appear unable to reset the date back to
the original date from within the valueChangeListener.  Any suggestions?

- Brendan

Re: valueChangeListener Question

Posted by Daniel Zwink <zw...@oio.de>.
Hi,

on 08.07.2005 18:27 CONNER, BRENDAN (SBCSI) wrote:
> Is there a way to revert the value of a component back to its old value
> in a valueChangeListener?  I see that the valueChangeListener has access
> to both the old and new values.
> 
> In particular, I'm looking at the inputCalendar component, and I want to
> implement an application rule like "only future dates are allowed"
> (similar to a rule that would be implemented on an airline reservation
> system).  Ideally, I'd like the inputCalendar to only display links on
> future dates with this rule, but, as an alternative, I was thinking I
> might be able to specify a valueChangeListener for this component which
> compares the selected date to the current date and queues a an error
> message if the selected date is not in the future.  I tried this out,
> and it works (i.e., my valueChangeListener successfully queues an error
> message if the date is not in the future), except that the invalid date
> still ends up being selected.  I appear unable to reset the date back to
> the original date from within the valueChangeListener.  Any suggestions?

I think you better implement this by using an own validator!


Daniel
-- 
Orientation in Objects GmbH
Weinheimerstr. 68
D-68309 Mannheim
http://www.oio.de
Tel +49(0)621-71839-0
Fax. +49(0)621-71839-50