madrobby / scriptaculous

script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
http://script.aculo.us/
MIT License
2.32k stars 496 forks source link

afterUpdateElement on ENTER press #17

Open onomojo opened 14 years ago

onomojo commented 14 years ago

Currently, if no element is selected in Autocomplete it defaults to the first element if a user presses ENTER. This isn't a good default especially when the users passes in an afterUpdateElement function. The user most likely wants to update the contents of a DOM object after an element is selected with the search results. If no element is selected an the user presses enter its more useful to send the text field content to the user defined afterUpdateElement so that the user can do their own custom search against the field rather than assuming the user wants the first element to be selected.

My changes basically allow a user to define their own search function using afterUpdateElement if no element is selected and ENTER is pressed. If the user doesn't pass in an afterUpdateElement the function behaves as it does now.