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

Fixing JS error on autocomplete with preselect

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4-RC2
    • Component/s: wicket-extensions
    • Labels:
      None
    • Environment:
      Firefox 3, Linux.
      Wicket 1.3.4.

      Description

      There is a Javascript error when using the autocomplete text field with preselect.
      The error:
      "element.firstChild is null"

      The affected line is inside getSelectedValue():
      var attr=element.firstChild.childNodes[selected].attributes['textvalue'];

      How to reproduce:
      1) Type something into the autocomplete text field. The javascript will send an Ajax request.
      2) Hit enter quickly. When you hit it before the Ajax response arrives, the error occurs.

      It is because the preselect sets selected=0, before sending the Ajax request.
      It should be kept to -1 until the response arrives.

      I'm going to attach a short patch for this.

        Attachments

        1. lazy_preselect.diff
          1.0 kB
          Ivo Danihelka

          Activity

            People

            • Assignee:
              jdonnerstag Juegen Donnerstag
              Reporter:
              fidlej Ivo Danihelka
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: