Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3

listen for "selection changed" event at AutocompleteTextField

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2.2
    • 1.2.6, 1.3.0-beta1
    • wicket-extensions
    • None

    Description

      When using drop-down list you can listen to the onchange-Event (e.g. with a AjaxFormSubmitBehavior) in order to perform certain actions.

      This is not possible when using the AutocompleteTextField even if it is very like a drop-down list. Listening to onchange will activate you behavior at any keystroke and not only when the user selected one entry of the given list.

      As a "workaround" I changed the wicket-autocomplete.js in a way, that the AutocompleteTextField will fire the onload-Event whenever a selection was made. onload is no official event for a textfield in HTML so this is a kind of a hack. In addition, onload is fired when the RETURN was hit inside the textbox.

      I think the possibility to react on a selection by the user at an AutocompleteTextField would be desirable and enhances the things you can do with. E.g. I use AutocompleteTextField to display a list of matching dictionary-entries and if the user selects one of them I will load this one without additional interaction by the user. But since this is not really a very clean way of implementing this feature I'm in doubt wether this should really find it's way into a wicket release. Maybe there is already a way to listen to the mentioned event, but I didn't find it.

      diff of wicket-autocomplete.js:
      63a64
      > obj.onload();
      65c66,70
      < }

      > }
      > else
      >

      { > obj.onload(); > }

      200a206,207
      > var obj=wicketGet(elementId);
      > obj.onload();

      Attachments

        1. wicket-autocomplete.diff
          0.4 kB
          Thomas Krause

        Activity

          People

            janne Janne Hietamaki
            sørlandchips Thomas Krause
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: