I tried to simplify my code in order to post here and to see if someone have
time to help me out

test.html
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="/javascripts/prototype.js" type="text/javascript"></script>
<script src="/javascripts/scriptaculous.js" type="text/javascript"></script>
</head>
<body>
<div id="replace">
<form>
<table><tr><td>AA</td><td>BB</td></tr>
<tr><td>R11</td><td>R12</td></tr>

<tr><td onclick="new Ajax.Request('/test1.html', {asynchronous:true,
onSuccess: function(t) { $('replace').innerHTML=t.responseText;}})">R21</td>
<td><input type=text name="test" id="mio"><div id="autoc"
class="autocomplete"></div><script type="text/javascript"
language="javascript">var pippo=new Ajax.Autocompleter(
"mio", "autoc", "/return.html", {});</script>

R22</td></tr>
<tr><td>R31</td><td>R32</td></tr>
</table>
</form>
</div>


test1.html
<form>
<table><tr><td>AA</td><td>BB</td></tr>
<tr><td>R11</td><td>R12</td></tr>

<tr><td onclick="new Ajax.Request('/test1.html', {asynchronous:true,
onSuccess: function(t) { $('replace').innerHTML=t.responseText
;}})">R22341</td>
<td>
<input type=text name="test" id="mio"><div id="autoc"
class="autocomplete"></div><script type="text/javascript"
language="javascript">var pippo=new Ajax.Autocompleter("mio
", "autoc", "/return.html", {});</script>

R22</td></tr>
<tr><td>R31</td><td>R32</td></tr>
</table>
</form>

return.html
<ul>
   <li id="1">your mom</li>
   <li id="2">yodel</li>
</ul>

If I click on the second row the autocomplete does not work anymore

On 12/28/06, Il Neofita <[EMAIL PROTECTED]> wrote:

I will try to explain what I am doing.

I have a page loaded with a table, when I press in a row the table is
reloaded and in the row that I selected I put the input box. If I do this
the autocompleter does not work. Now, I cannot understand how I can solve
this problem having the new event hadler to point to this new element.

Thank you

On 12/28/06, Christophe Porteneuve <[EMAIL PROTECTED]> wrote:
>
>
> Il Neofita a écrit :
> > If do you have time can you explain to me a little bit more, since I
> do
> > not know nothing regarding Draggable and Sortable, I will appreciate
> > your help.
>
> Actually, in your specific case (which, I gather, only involved
> auto-completion), there are only two event handlers being created when
> you do:
>
>         new Ajax.Autocompleter(...);
>
> - one on blur
> - one on keypress
>
> They both tackle your input field.
>
> When you replace the DOM fragment that contains your input field (do you
> really need to?!), those events never get fired again, because what the
> user types in is another field, a new one, created by your
> fragment-replacing code ( e.g. the processing of a Ajax.Updater, or a
> call of yours to Element.replace or Element.update).
>
> It's not too bad that you didn't remove those two event observers;
> they're not going to be triggered, and the garbage collector will handle
>
> them properly.
>
> However, what you need, at the minimum, is to follow DOM replacement by
> an identical call to "new Ajax.Autocompleter(...)", to recreate the
> functionality for your new DOM elements.
>
> Still, the question remains:  why on Earth do you replace your
> auto-completed field (and its completion zone)?  Can't you do otherwise?
>
> --
> Christophe Porteneuve a.k.a. TDD
> "[They] did not know it was impossible, so they did it." --Mark Twain
> Email: [EMAIL PROTECTED]
>
> > >
>


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to