views:

10

answers:

0

hi all,

I have a problem in calling autocomplete function which exist's in the controller,as soon as i enter a character i should find the dropdown of matching strings from the database of a particular table user.

In my user.html.erb has autocomplete textfield <%= text_field_with_auto_complete :user,:name,{}, :skip_style => true ,:autocomplete => "off" %>

In the controller i have the method as

class UserController < ApplicationController skip_before_filter :verify_authenticity_token, :only =>[:auto_complete_for_user_name]

def auto_complete_for_user_name() print " calling auto_complete_for_user_name" name = params [:user][:name] @user= PlowClass.find(:all , :conditions=>"name like '%"+'name'.upcase+"%'")
render :partial => 'username'
end

i tried another way like

auto_complete_for :user,:name

but it will get every time when the controller get executed irrespective of the method name. but when i enter text in autocomplete text field this function is not getting called.

thanks and regards, Mahesh