live search

hi all, i have implemented live search using scriptulous and i am getting the list

the problem is that when i select an item from the list white spaces gets appended in front " item" of the selection in firefox and in opera

front and behind " item "

i printed the value in console and saw it gives “item” but in textbox after selection whitespaces gets appended

any idea what can be wrong anyone faced similar problem

or is it that something is wrong the way i have implemented

regards gaurav

I’ve had to cope with the same thing. I just stripped off the surrounding space before using the autocomplete value.

Best regards

Peter De Berdt

hi peter,

can you just explain where u made the changes

is it like using js event you take the value from textbox strip it of and then put it back or theres a ruby way ???

regards gaurav

Out of my head:

in my controller method “search”, I have something like:

@results=Model.find_by_something(params[:query].chomp.strip)

Best regards

Peter De Berdt

hi,

i found that from controller the value was coming fine

i made changes in "updateElement: function(selectedElement) "

added "this.element.value = (value.replace(/^\W+/,‘’)).replace(/\W+$/,‘’); "

in controls.js

it worked

regards gaurav