Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Zbynek Vavros
I'm not sure we understand each other. Such a behavior is already there using AjaxFormComponentUpdatingBehavior ("change"). This way ajax is triggered ONLY when value is selected from choices (either by mouse or by keyboard). = exactly what I want. I tested this in small prototype and it works

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Martin Grigorov
At the moment wicket-autocomplete.js triggers event with name "change": https://github.com/apache/wicket/blob/580d92ddf068040214669c085f54d2faa702a921/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js#L446 This makes it hard for the

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Sven Meier
Hi, wicket-autocomplete.js surpresses the "change" event while you operate on the drop down. When it decides that your selection has finished (e.g. the drop down is hidden), the "change" event is triggered subsequently. The AjaxFormComponentUpdatingBehavior will pick up the "change" event

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Zbynek Vavros
I was s afraid of that :D Just out of curiosity, I see in wicket-autocomplete.js that the onchange event sets "triggerChangeOnHide" to true. How is this handled afterwards ? I mean how does it get from here to calling the ajax ? Thanks! On Thu, Jan 21, 2016 at 11:50 AM, Sven Meier

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Sven Meier
Hi, well, it seems you'll have to strip down your business app until it works as expected :P Have fun Sven On 21.01.2016 11:47, Zbynek Vavros wrote: I'm not sure we understand each other. Such a behavior is already there using AjaxFormComponentUpdatingBehavior ("change"). This way ajax is

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Zbynek Vavros
What I mean by final value is value selected from list of options. The OnChangeAjaxBehavior you suggested will do ajax on every key stroke. So lets say my autocomplete display list of cities. I want the method called when user selects a value "London" from list. Not on each stoke "L", "Lo",

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Martin Grigorov
Hi, How do you decide when "final" value is entered ? You can use Ajax throttling to avoid sending requests on every typed character but only after N ms after the last typed character. See AjaxRequestAttributes#setThrottling() for this option. There is no magic that will read your users' mind to

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Martin Grigorov
OK. I understand now. Looking at wicket-autocomplete.js I see that it triggers "change" event after click on an entry. To support use cases like yours it has to trigger some custom event too, e.g. "itemselected.wa" ("wa" is a sample namespace for wicket-autocomplete). The you can use

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Zbynek Vavros
Hey, sorry for not explaining properly... I already tried that and in this case the the ajax call is triggered on "inputchange" as well, meaning on every key stroke. This is not desirable because we use the value of this autocomplete field to calculate value of another fields in form. This

Re: AutoCompleteTextField and change AjaxFormComponentUpdatingBehavior

2016-01-21 Thread Martin Grigorov
Hi, It is not very clear what exactly is the issue. As far as I understand the problem is that the Ajax call is triggered only when you navigate to another form field. If this is the issue then try by using OnChangeAjaxBehavior instead of AjaxFormComponentUpdatingBehavior. Martin Grigorov Wicket