Paul, isn't something along these lines what valueChangeNotifier
already does?  Seems like it'd be easier and safer to simply use the
existing component.

Like I said, I haven't used it, but I think it just defers the event
handling like you've proposed below.   A first glance at your code
before seems to indicate that you'd requeue the event every phase.
Do you need to make sure you haven't already requeued it to
UPDATE_MODEL_VALUES?



On 4/13/07, Paul Spencer <[EMAIL PROTECTED]> wrote:
Mike,
I found the following. Does it look reasonable?

   public void changeState(ValueChangeEvent event)
   {
     PhaseId phaseId = event.getPhaseId();
     if (phaseId.equals(PhaseId.ANY_PHASE))
     {
       event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
       event.queue();
     }
     else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES))
     {
       // correct phase update local variables for the new class Number
       String newValue = (String) event.getNewValue();
       if ("NY".equals(newValue))
       {
         setCity("Albany");
       }
     }
   }


Should I write this up in the wiki?

Paul Spencer

Mike Kienenberger wrote:
> http://myfaces.apache.org/sandbox/tlddoc/s/valueChangeNotifier.html
>
> I've never used it as
> t:updateActionListener/f:setPropertyActionListener has always worked
> in my own use cases.
>
> On 4/13/07, Paul Spencer <[EMAIL PROTECTED]> wrote:
>> I have a bean with 2 fields, state and city, with a valueChangeListener
>> on the state field.  The listener will set the city based on new new
>> state.  The problem is the city is being overwritten in the model update
>> phase.  So my question is:
>>
>>    What is the best way to update another field inside a
>>    valueChangeListener so the updated value is not overwritten?
>>
>> Paul Spencer
>>
>


Reply via email to