AjaxBehavior and onblur

2009-08-05 Thread Steve Lowery
I have a Form on my page that has amongst others 3 fields:  zipcode,
city, and state.  I would like it when the user enters data in the
zipcode field, an ajax request be generated to lookup and populate the
city and state fields in the form.  However, I don't want the underlying
model (an employee) to be updated until the form is submitted.  The
textfields' models are PropertyModels of the underlying Employee model.
AjaxFormComponentUpdatingBehavior(onblur) updates the model, but
persists the changes to the Employee object since it is a managed object
(we are using hibernate).  If I use an AjaxEventBehavior(onblur), the
model doesn't get updated, but the getInput() and getValue() on the
zipcode textfield doesn't reflect what the user just entered.  It still
has what was in the original model.  Is there some way to have an ajax
call for an onblur (or whatever event) not update the model, but give
the handling code access to what data is currently in the component the
behavior is attached to?

 

Thanks, Steve



Re: AjaxBehavior and onblur

2009-08-05 Thread Igor Vaynberg
the simplest way is to use javascript to set the values on the textfields

-igor

On Wed, Aug 5, 2009 at 3:07 PM, Steve Loweryslow...@gatessolutions.com wrote:
 I have a Form on my page that has amongst others 3 fields:  zipcode,
 city, and state.  I would like it when the user enters data in the
 zipcode field, an ajax request be generated to lookup and populate the
 city and state fields in the form.  However, I don't want the underlying
 model (an employee) to be updated until the form is submitted.  The
 textfields' models are PropertyModels of the underlying Employee model.
 AjaxFormComponentUpdatingBehavior(onblur) updates the model, but
 persists the changes to the Employee object since it is a managed object
 (we are using hibernate).  If I use an AjaxEventBehavior(onblur), the
 model doesn't get updated, but the getInput() and getValue() on the
 zipcode textfield doesn't reflect what the user just entered.  It still
 has what was in the original model.  Is there some way to have an ajax
 call for an onblur (or whatever event) not update the model, but give
 the handling code access to what data is currently in the component the
 behavior is attached to?



 Thanks, Steve



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org