Damon Hill
2006-Jun-23 19:41 UTC
[Rails] Re:(RESOLVED, KIND OF) auto complete and after update element
Well, I did finally get the after_update_element to call my controller action with the following syntax: <%= text_field_with_auto_complete ( :customer, :company_name, { :size => "45" }, :after_update_element => "function(element,value){" + remote_function( :url => { :action => :get_customer_info }, :with => "''customer=''+$F(''customer_company_name'')") + "}" ) %> It finds the correct customer in the database, and then in the action I am rendering a template that consists of several javascript element updates similar to the following: document.getElementById("po_customer_address").value = ''<%@found_customer.address %>''; However, although this template is getting called (per the log files), the information that is found in the database in not getting updated via the template parsing. The frustrating part is this worked when I had the company names as selects and used observe fields. I switched becuase there are several thousand records of customers and that was one huge select box. Allowing the user to type made more sense. However, now the information isn''t getting updated now, so maybe it wasn''t such a bad thing to have huge select boxes ;) Anyone have any idea why now the parsing of this template doesn''t update the information in the view page? Thanks in advance, -- ~d www.razorpress.com On 6/23/06, Damon Hill <mdamonhill@gmail.com> wrote:> > I have done several searches via the web and all of my 13,000+ emails from > the rails list. > I can''t seem to find or discover exactly why the below syntax does not > cause the app to call the get_supplier_address action in the controller. > > > <%= text_field_with_auto_complete ( :supplier, :company_name, > :after_update_element => "function(element,value){" + > remote_function( :url => { :action > => :get_supplier_address }, :with => "''supplier=''+value") + "}" ) %> > > The text field with auto complete works beautifully. > I select the supplier, but then, I want the after update to fire and take > the value of the auto complete that the user selected and with the supplier > company name, fill in the address information from the db. > Problem is the get_supplier_address is never called. > > Does anyone see what is possibly wrong or offer suggestions on what I > assume to be a trivial issue? > > Rails 1.1.2 > Rails 1.8.4 > RHEL > Apache 2.2 > > -- > ~d > www.razorpress.com >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060623/a30ec512/attachment.html