[Proto-Scripty] Re: Observer problem

2009-12-15 Thread david
Hi rui,

Your problem could be resolved using event delegation, you set the
event on the body of you document.
Whne the observed event is fired, you can know on which element it is
applied. If the element is the element you *really*  want to observe,
just launch your code that handle that event.

In that case, element could be removed (no more event could be fired)
and can be re-inserted. In that last case, the element have changed,
but for the event delegation, the only important thing is that the
element.id exist, and the event is well fired without anything to do.

--
david

On 14 déc, 01:15, Rui Campos  wrote:
> Thanks for the reply, it solved my problem  :)
>
> I moved the input box away from the part that I want to update and it
> worked.
>
> Thanks again,
> Rui Campos.
>
> On Dec 13, 10:03 pm, "T.J. Crowder"  wrote:
>
> > Hi,
>
> > If you're replacing the element you're observing, that's your problem
> > -- events are observed on instances. Even if you replace an element
> > with the ID "X" with another element with the ID "X", they're
> > different elements.
>
> > From your description, it sounds like you're replacing more than you
> > really should be, but it's hard to tell without code. If it's not that
> > you're replacing the element you're observing, I'd suggest replicating
> > the problem in a small, self-contained example[1].
>
> > [1]http://proto-scripty.wikidot.com/self-contained-test-page
>
> > HTH,
> > --
> > T.J. Crowder
> > Independent Software Consultant
> > tj / crowder software / comwww.crowdersoftware.com
>
> > On Dec 13, 5:27 pm, Rui Campos  wrote:
>
> > > Hello,
>
> > > I'm currently doing a college project on ruby on rails and I have to
> > > do a common Tag system for wiki pages. I have an observer "observing"
> > > a input field to check if a tag that the user is trying to add already
> > > has a similar one on the system, if there is one, a text box appears
> > > asking if the user wants to replace the tag introduced by the already
> > > in the system. The tag adding is made with ajax.
>
> > > The problem is that after the user adds a tag, meaning he clicks the
> > > add button and the ajax call refreshes the tag box, the observer stops
> > > working and i have to refresh the page. I'm not sure if this is a bug
> > > with my code or if it is intended. If it is intended, is there a work
> > > around?
>
> > > If there is already a discussion about a similar issue, I was unable
> > > to find it. Please direct me to it if possible : )
>
> > > Thanks,
> > > Rui Campos.

--

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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Observer problem

2009-12-13 Thread Rui Campos
Thanks for the reply, it solved my problem  :)

I moved the input box away from the part that I want to update and it
worked.

Thanks again,
Rui Campos.

On Dec 13, 10:03 pm, "T.J. Crowder"  wrote:
> Hi,
>
> If you're replacing the element you're observing, that's your problem
> -- events are observed on instances. Even if you replace an element
> with the ID "X" with another element with the ID "X", they're
> different elements.
>
> From your description, it sounds like you're replacing more than you
> really should be, but it's hard to tell without code. If it's not that
> you're replacing the element you're observing, I'd suggest replicating
> the problem in a small, self-contained example[1].
>
> [1]http://proto-scripty.wikidot.com/self-contained-test-page
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Dec 13, 5:27 pm, Rui Campos  wrote:
>
> > Hello,
>
> > I'm currently doing a college project on ruby on rails and I have to
> > do a common Tag system for wiki pages. I have an observer "observing"
> > a input field to check if a tag that the user is trying to add already
> > has a similar one on the system, if there is one, a text box appears
> > asking if the user wants to replace the tag introduced by the already
> > in the system. The tag adding is made with ajax.
>
> > The problem is that after the user adds a tag, meaning he clicks the
> > add button and the ajax call refreshes the tag box, the observer stops
> > working and i have to refresh the page. I'm not sure if this is a bug
> > with my code or if it is intended. If it is intended, is there a work
> > around?
>
> > If there is already a discussion about a similar issue, I was unable
> > to find it. Please direct me to it if possible : )
>
> > Thanks,
> > Rui Campos.

--

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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.




[Proto-Scripty] Re: Observer problem

2009-12-13 Thread T.J. Crowder
Hi,

If you're replacing the element you're observing, that's your problem
-- events are observed on instances. Even if you replace an element
with the ID "X" with another element with the ID "X", they're
different elements.

>From your description, it sounds like you're replacing more than you
really should be, but it's hard to tell without code. If it's not that
you're replacing the element you're observing, I'd suggest replicating
the problem in a small, self-contained example[1].

[1] http://proto-scripty.wikidot.com/self-contained-test-page

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Dec 13, 5:27 pm, Rui Campos  wrote:
> Hello,
>
> I'm currently doing a college project on ruby on rails and I have to
> do a common Tag system for wiki pages. I have an observer "observing"
> a input field to check if a tag that the user is trying to add already
> has a similar one on the system, if there is one, a text box appears
> asking if the user wants to replace the tag introduced by the already
> in the system. The tag adding is made with ajax.
>
> The problem is that after the user adds a tag, meaning he clicks the
> add button and the ajax call refreshes the tag box, the observer stops
> working and i have to refresh the page. I'm not sure if this is a bug
> with my code or if it is intended. If it is intended, is there a work
> around?
>
> If there is already a discussion about a similar issue, I was unable
> to find it. Please direct me to it if possible : )
>
> Thanks,
> Rui Campos.

--

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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.