Moodle
  1. Moodle
  2. MDL-31728

Autocomplete form field element causes javascript error on keypress

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
      None
    • Testing Instructions:
      Hide

      Edit any form in the system (I used forgot_password form to test with) and add these lines

      $autocomplete =$mform->addElement('autocomplete', 'fruit', 'Favourite fruit:');
      $options = array("Apple", "Orange", "Pear", "Strawberry");
      $autocomplete->setOptions($options);

      Visit the form's web page, put the cursor in the Favourite fruit box and start typing - watch the javascript console for errors.

      Show
      Edit any form in the system (I used forgot_password form to test with) and add these lines $autocomplete =$mform->addElement('autocomplete', 'fruit', 'Favourite fruit:'); $options = array("Apple", "Orange", "Pear", "Strawberry"); $autocomplete->setOptions($options); Visit the form's web page, put the cursor in the Favourite fruit box and start typing - watch the javascript console for errors.
    • Affected Branches:
      MOODLE_22_STABLE
    • Rank:
      38321

      Description

      If you create an autocomplete form field element and try to use it, the javascript error "autocomplete is not a function" occurs on keypress in the text box. The function clearly exists in the html source for the page though.

      This specific form field hasn't changed between Moodle 1.9 and Moodle 2.0, but the autocomplete feature did work in Moodle 1.9, so I'm not sure why its broken now. Oddly, if you change the function name to "autocompl" it works perfectly. That made me think there must be some other autocomplete() javascript function somewhere causing a conflict, but I searched the codebase and can't find one!

      We've seen this in a range of browsers including IE8, FF10 and chrome.

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this issue.

        We have detected that this issue has been inactive for over a year. It was reported as affecting versions that are no longer supported.

        If you believe that this issue is still relevant to current versions (2.5 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

        Michael d.

        TW9vZGxlDQo=

        Show
        Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year. It was reported as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.5 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d. TW9vZGxlDQo=
        Hide
        Jenny Gray added a comment -

        Tested today on 2.6, issue still relevant.

        Show
        Jenny Gray added a comment - Tested today on 2.6, issue still relevant.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: