My server-side script generates the <ul>...</ul> structure to pass
back to the "update" <div> element. The <li> elements contain some
text embedded inside <span>. Here is a sample of what the server-side
script passes back to the Ajax.Autocompleter instance:

<ul>
  <li style="overflow:auto;"><span style="display:none;">1</span><span
style="width:150px;float:left;">John</span><span style="width:
200px;float:left;">Doe</span></li>
  <li style="overflow:auto;"><span style="display:none;">2</span><span
style="width:150px;float:left;">Jane</span><span style="width:
200px;float:left;">Doe</span></li>
</ul>

(The reason I do this is because I want to see the drop down list
display the list items in a tabular layout... which was the original
topic of this thread)

However, when I select an item from this drop down list, only the
plain text gets copied into the "element" <i.e. the <input> text box)
linked to the Ajax.Autocompleter control. What I need is for the
contents of the selected <li> element to be copied over, so I can work
with the raw HTML as needed. When I perused the JS source, I
understand that the updateElement function is responsible for the
copying, and it employs Element.collectTextNodes and
Element.collectTextNodesIgnoreClass methods to extract the textual
content from the selected <li> element. I tried to hack my way around
this by replacing the line:

value = Element.collectTextNodesIgnoreClass(selectedElement,
'informal');

with:

value = selectedElement.innerHTML

It seems like this works, but I am very averse to modifying well-
tested code (not to mention, my JS skills are very immature) and
potentially breaking another part of my application that depends on
the default implemented behavior of this control. Can anyone tell me
if there is some (more recommended) means of copying the contents of
the selected <li> element into the text box without modifying
controls.js? Ideally, it would be nice to have an option to use in the
constructor, to toggle between copying "raw" content versus textual
content.

Thanks.

Ashwin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to