Textfields do recive onchange event, even AutocompleteTextField has modified
version off onchange event handler.
Whats more new AjaxFormComponentUpdatingBehavior("onchange"){..}; works well
in this scenario but
OnChangeAjaxBehavior not. 
I looked at OnChangeAjaxBehavior implemenation and this is a subclass of
AjaxFormComponentUpdatingBehavior class with super("onchange"); call in its
constructor. 
This class only provides its own implementation of onComponentRendered
method so there should be a problem. 
When I looked at OnChangeAjaxBehavior class contract description in JavaDoc
("A behavior that updates the hosting FormComponent via ajax when value of
the component is changed. This behavior uses best available method to track
changes on different types of form components.") there is no mention that it
shouldnt be used with some components so I think its bug either in
OnChangeAjaxBehavior class or AutocompleteTextField class.

Correct me if I'm wrong.
Regards Daniel


igor.vaynberg wrote:
> 
> probably because textfields do not receive onchange event, or
> something else was hijacking it.
> 
> -igor
> 
> On Tue, Oct 28, 2008 at 6:17 AM, dlipski <[EMAIL PROTECTED]>
> wrote:
>>
>>
>>
>> dlipski wrote:
>>>
>>> Hi,
>>>
>>> First, problem description:
>>> Recently I was asked to change DropDownChoice field into
>>> AutoCompleteTextField.
>>> Everything was ok untill I noticed that old DropDownChoice field has
>>> attached OnChangeAjaxBehavior.
>>> Ofcourse what works well with DropDownChoice doesnt work as I want with
>>> AutoCompleteTextField.
>>> The problem is that I want to update a model after user selects one of
>>> choices(from autocomplete) not after any change of text field.
>>> I found getOnSelectJavascriptExpression method in
>>> AbstractAutoCompleteRenderer (since Wicket 1.4 ?) and I thought that it
>>> would be a good place to call some JS to update text field model.
>>> I looked at
>>> http://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html to
>>> see
>>> how to call server side Wicket code from JavaScript.
>>> Next I had the idea to attach to text field
>>> AjaxFormComponentUpdatingBehavior and call its getCallbackUrl() from
>>> JavaScript returned from mentioned earlier
>>> getOnSelectJavascriptExpression().
>>> The problem is that AjaxFormComponentUpdatingBehavior expects event name
>>> in constructor  - in this case I dont need any onXXX event because I
>>> will
>>> call its getCallbackUrl() directly from JS.
>>>
>>> Now few questions:
>>> 1)How to update (via Ajax) model of some FormComponents from JavaScript?
>>> Do I have to attach AjaxFormComponentUpdatingBehavior to some dummy
>>> event
>>> and call its getCallbackUrl() directly in JavaScript ? If so, its kind
>>> of
>>> hacking for me and AjaxFormComponentUpdatingBehavior should provide
>>> no-argument constructor.
>>>
>>> 2)Does JavaScript returned from getOnSelectJavascriptExpression is
>>> called
>>> after corresponding TextField value has been set ?
>>>
>>> 3)At Wicket wiki I found description how to work with
>>> AutoCompleteTextField and Models:
>>> http://cwiki.apache.org/WICKET/autocomplete-using-a-wicket-model.html
>>> I dont understand why this problem is not solved by subclassing directly
>>> form AutoCompleteTextField and overriding getConverter and provide some
>>> custom converter ?
>>>
>>> Ps. My colegue told me to attach AjaxFormComponentUpdatingBehavior to
>>> onBlur event, maybe this is the solution ? (but still, for me better
>>> place
>>> to update a model is in Javasript from getOnSelectJavascriptExpression()
>>> than in onblur event handler...)
>>>
>>> Best regards
>>> Daniel
>>>
>>
>> It was as simple as using a AjaxFormComponentUpdatingBehavior... I was
>> confused because I started with OnChangeAjaxBehavior and it was broking
>> AutoCompleteTextField - thats why I started thinking of diffrent
>> approaches.
>>
>> BTW. Why AjaxFormComponentUpdatingBehavior works well with
>> AutoCompleteTextField  and OnChangeAjaxBehavior doesnt ? Is it a bug in
>> OnChangeAjaxBehavior or the purpose of this class is different ?
>>
>> Regards Daniel
>>
>> --
>> View this message in context:
>> http://www.nabble.com/few-%28not-only%29-AutoCompleteTextField-questions-tp20131044p20207012.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/few-%28not-only%29-AutoCompleteTextField-questions-tp20131044p20214060.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to