The primary nature of the AjaxFormComponentUpdatingBehavior is to validate the 
input and update the model. If you are looking to do the validation piece 
without updating the model, you probably want to use an AjaxEventBehavior 
instead. In onEvent you can then call inputChanged and validate directly on the 
component without calling updateModel.

Thanks,
-David Phillips

-----Original Message-----
From: heapifyman [mailto:heapify...@gmail.com] 
Sent: Tuesday, August 07, 2012 5:07 AM
To: users@wicket.apache.org
Subject: Re: [1.5] AjaxFormComponentUpdatingBehavior and Cancel AjaxButton to 
reset form

If I use an AjaxLink instead of an AjaxButton I still get the same behaviour. 
The values in the form are not reset when clicking the Cancel link/button.

My form has a CompoundPropertyModel and just three TextFields.
Each TextField has an AjaxFormComponentUpdatingBehavior for validation on event 
"onchange". The Cancel AjaxLink should reset (and disable) the form but stay on 
the same page.

Now what I get is this: if the user changes a value and it is valid, the 
underlying model get's updated. Clicking Cancel afterwards does not reset the 
changed value back to the original value.

If I remove the AjaxFormComponentUpdatingBehavior Cancel AjaxLink works as 
expected.

I am looking for a way to have the Cancel link and still keep the 
AjaxFormComponentUpdatingBehavior.



2012/8/6 Bertrand Guay-Paquet <ber...@step.polymtl.ca>

> Hi,
>
> form.clearInput() only clears the raw input (what is received in the 
> current request) of the form components. That is, it doesn't modify 
> the underlying models. With setDefaultFormProcessing(**false), this 
> means that your FormComponent models are not updated at all.
>
> The AjaxFormComponentUpdatingBehav**ior should only be triggered when 
> input changes on the text fields. It plays no part otherwise when 
> clicking a button.
>
> As a sidenote, why do you use a Button? This component causes the form 
> to be submitted but apparently you don't need the values for this 
> action. A link would save a bit of processing and transfer.
>
> Bertrand
>
>
> On 06/08/2012 12:33 PM, heapifyman wrote:
>
>> Hello,
>>
>> I've been struggling for a while now with a problem that a Cancel 
>> AjaxButton (with setDefaultFormProcessing(**false)) calling
>> form.clearInput()
>> would not reset my form to original values.
>> The problem seems to be that I have 
>> AjaxFormComponentUpdatingBehav**ior
>> (onchange event) for validation added to a few Textfields of the form.
>> Am I right, that the behaviour updates the model and thus the Cancel 
>> button cannot restore the original value?
>>
>> And if that really is the problem, is there a best practice how to 
>> combine the two functionalities?
>>
>> Thanks in advance.
>>
>>
>
> ------------------------------**------------------------------**------
> --- To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org<users-unsubscribe@wicket.apache.
> org> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to