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