>
> I'm having some issues mixing zones and my own custom ajax events.
>
   What is happening is when I update a zone via the form submit.
   My other event listeners get removed from the page.

> For example:
>
> I have a simple form that contains a zone like the following:
>
> <t:form t:id="form" zone="myZone">
>     <t:zone id="myZone">
>         <t:TextField t:id="name" value="name"/>
>         <t:Submit t:id="add" value="Add">
>     </t:zone>
>
</t:form>
>

outside the form I'll have some other input elements

<input t:type="any" id="outsideTheForm" value="prop:someValueFromThePage"/>

For this element I'll add a prototype event listener, like the following:

var MyClass = Class.create({
    function: initialize(eventUrl) {
        this.eventUrl = eventUrl;
        $("outsideTheForm").observe("keyUp", this.doSomething.bind(this));
    },

    function: doSomething() {
        new Ajax.Request(this.eventUrl, {
            onSucess: function(transport) {
                var json = transport.responseJSON;
                alert(json.message);
            }
        });
    }
});


The events for this element work perfectly fine, until I click the submit
button
within the ajax form.  Once I click on the submit button my ajax events
cease to function.
I've found that I can re-initialize my events after a zone update, but this
is very tedious,
and sometimes I don't have the proper context information that I need
to re-initialize
my javascript events (This can be worked around as well. But it gets messy).

Is there a way to prevent zone updates from removing all of my event
listeners?
Or a more preferred method for something like this?

I would appreciate any feedback?

Regards,
Travis Romney

Reply via email to