I just noticed that when using autocomplete and firefox, if I return a
list containing whitespace, my input field is not updated. I''ll try
to explain more of the details, I''m using Ajax.Autocompleter and
I''ve
used the "tokens" option to allow multiple values separated by
commas. If the server script responding to the ajax request returns a
list in which the list items contain whitespace, the values are not
properly appended to the input field. IE seems to work fine, but for
some reason firefox appears to ignore the new input text value when it
contains whitespace (or at least newlines). Of course, one way for me
to resolve this is to simply be more careful about how I construct my
list on the server side, ensuring I don''t insert any extraneous
whitespace. But the patch below strikes me as a potential solution
that shouldn''t cause any additional problems and probably represents
the desired behavior. In fact, it might even be better to strip all
strings returned from the collectTextNodes* function, or that might be
overreaching a bit.
--Bryan
--- ./src/controls.js.orig 2008-03-20 10:35:44.017733000 -0400
+++ ./src/controls.js 2008-03-20 10:36:30.861783400 -0400
@@ -244,6 +244,7 @@
if(nodes.length>0) value = Element.collectTextNodes(nodes[0],
this.options.select);
} else
value = Element.collectTextNodesIgnoreClass(selectedElement,
''informal'');
+ value = value.strip();
var bounds = this.getTokenBounds();
if (bounds[0] != -1) {
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---