Wicket
  1. Wicket
  2. WICKET-4204

AutoCompleteTextField+OnChangeAjaxBehavior doesn't fire updates on item selection

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.2
    • Fix Version/s: 6.0.0-beta1
    • Component/s: wicket-extensions
    • Labels:
      None

      Description

      When adding an OnChangeAjaxBehavior to an AutoCompleteTextField, onUpdate() doesn't fire when selecting an item from the autocomplete item list.
      It is firing when using an AjaxFormComponentUpdatingBehavior.

      wicket-autocomplete.js seems to be using the onchange event handler, which is cleared by Wicket.ChangeHandler.
      Maybe obj.onchangeoriginal should be checked in first place in wicket-autocomplete.js

      See this related discussion at SO for context: http://stackoverflow.com/q/8047769/851811

      1. WICKET-4204.patch
        1 kB
        Andrea Del Bene

        Issue Links

          Activity

          Hide
          Martin Grigorov added a comment -

          I'd say this is fixed in 6.0.
          Here Autocomplete component uses the special "inputchanged" (see OnChangeAjaxBehavior) event to work. I added explicitly OnChangeAjaxBehavior to the autocomplete component and it didn't break the functionality.
          #onChange() method received just the letter typed by the user, not the selected choice afterwards.

          Show
          Martin Grigorov added a comment - I'd say this is fixed in 6.0. Here Autocomplete component uses the special "inputchanged" (see OnChangeAjaxBehavior) event to work. I added explicitly OnChangeAjaxBehavior to the autocomplete component and it didn't break the functionality. #onChange() method received just the letter typed by the user, not the selected choice afterwards.
          Hide
          Andrea Del Bene added a comment -

          @Martin
          I hope so too

          @Xavier
          You are right, but at this point it's not clear to me why AutoCompleteTextField overrides its onchange handler with Wicket.ChangeHandler...

          Show
          Andrea Del Bene added a comment - @Martin I hope so too @Xavier You are right, but at this point it's not clear to me why AutoCompleteTextField overrides its onchange handler with Wicket.ChangeHandler...
          Hide
          Xavier López added a comment -

          I've not tried the patch, but if it is firing "onpaste"/"oninput", wouldn't it make other behaviors that only appended "onchange" (such as new AjaxFormComponentUpdatingBehavior("onchange")) stop working (they were before the patch).

          Show
          Xavier López added a comment - I've not tried the patch, but if it is firing "onpaste"/"oninput", wouldn't it make other behaviors that only appended "onchange" (such as new AjaxFormComponentUpdatingBehavior("onchange")) stop working (they were before the patch).
          Hide
          Martin Grigorov added a comment -

          I hope all this will be solved cleanly with Wicket.next's use of jQuery.

          Show
          Martin Grigorov added a comment - I hope all this will be solved cleanly with Wicket.next's use of jQuery.
          Hide
          Andrea Del Bene added a comment -

          When an item of the list is selected, the event "onclick" is passed to AutoCompleteTextField's onchange by the click handler defined at line 578 of wicket-autocomplete.js.
          A possible solution is to trigger a new event which is not ignored by AutoCompleteTextField. See patch.

          Show
          Andrea Del Bene added a comment - When an item of the list is selected, the event "onclick" is passed to AutoCompleteTextField's onchange by the click handler defined at line 578 of wicket-autocomplete.js. A possible solution is to trigger a new event which is not ignored by AutoCompleteTextField. See patch.

            People

            • Assignee:
              Martin Grigorov
              Reporter:
              Xavier López
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development