Hi Moe,

This was a workaround for handling Ajax requests in Click <= 2.2.0. When the 
text is entered into
the field, the data is posted to the server and the Field needs to be 
processed. It was added to the
page so that Click can process it. If it wasn't added to the page, it would not 
have been processed.

Click 2.3.0 has built in Ajax support so the workaround is not needed. See:
https://issues.apache.org/jira/browse/CLK-707

Kind regards

Bob

On 2/12/2010 01:02, Moritz Kammerer wrote:
> Hi,
> 
> the validate() method from a AutoCompleteTextField is called twice when a 
> form is submitted.
> 
> In AutoCompleteTextField, there is a block of code:
>         if (control == null) {
>             // Ensure current parent control does not change
>             Object parent = getParent();
>             page.addControl(this); // NOTICE THIS!!
>             setParent(parent);
> 
> Why is there a call to page.addControl(this)? After some debugging i found 
> that this statement adds
> the control itself to the page controls. The first call to validate() is made 
> through the form, in
> which the AutoCompleteTextField is contained in. The second call is made 
> through the process()
> method from the page itself.
> 
> The problem with the second validate call is, that it throws away a custom 
> error message assigned to
> the field, because the validate() calls setError(null).
> 
> Kind regards,
> 
> Moe
> 

Reply via email to