I have been trying to figure out an issue that I have run in to for
the last couple of days. I am using autocomplete in a few areas in my
project to pull up a list of things when adding something that has a
relationship so that a user doesn''t create duplicates. In some cases
the fields for those objects are being added to the form after a user
clicks on a add thing link and in other cases the fields are being
built when the page loads. The issue I am having is that if I use the
exact same code for the fields it works when I add the fields after
the form has been generated via ajax but doesn''t work when the fields
are present on page load. I am running on edge rails (6424), using
ujs, prototype 1.5.0_rc1, scriptaculous 1.6.5. I know those are a
little bit older but I am also using lightbox 2.02 and it does not
like newer prototype and scriptaculous builds in safari, I did try the
newer scriptaculous and prototype builds and it still is an issue.
Here is an example of the code being used:
-- Code used in view (either directly on form or sent to form via
partial --
<%= text_field_tag("publisher_name", nil, {:size => 30, :class
=>
"inputText"}) %>
<%= auto_complete_field("publisher_name", :url =>
auto_complete_publishers_path, :method => :get) %>
<div class="auto_complete"
id="publisher_name_auto_complete"></div>
-- end code --
Basically I am using a custom auto complete function and my app is
REST based. I have routes set up and as I mentioned everything works
as advertised in one case but not the other.
When I add the field on page load of the form I get the following
error from prototype:
-- error message (firebug in firefox output on page load --
hide(null)prototype.js (line 1153)
baseInitialize("publisher_name",
"publisher_name_auto_complete",
Object paramName=publisher_name tokens=[0] frequency=0.4)controls.js
(line 84)
initialize("publisher_name", "publisher_name_auto_complete",
"/
publishers;auto_complete", Object paramName=publisher_name tokens=[0]
frequency=0.4)controls.js (line 335)
create()prototype.js (line 23)
[Break on this error] $(element).style.display = ''none'';
-- end error message --
Any one have any idea what is going on? I have tried everything that i
can think of to get this to work and for the life of me can not.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---