Getting crickets here, so I'll publish my solution and see if anyone has any
comments. I'm using the jQuery widget factory to re-set the widget name (so
that it's called as the same widget), while copying the original widget into
the new widget of the same name. I can then over write the trigger event and
add a custom event listener.

$.widget('ui.tapestryFormInjector',$.ui.tapestryFormInjector, {
    trigger: function() {
        var that = this,
            el = $("#" + this.options.element);

        var successHandler = function(data) {
            $.tapestry.utils.loadScriptsInReply(data, function() {
// Clone the FormInjector element (usually a div)
// to create the new element, that gets inserted
// before or after the FormInjector's element.
                var newElement = el.clone(false);
                newElement.attr("id", data.elementId);
                newElement.html(data.content);
                newElement = that.options.below ? el.after(newElement) :
el.before(newElement);
                newElement.effect(that.options.show);
            });
            $.publish(FORM_INJECT_SUCCESS, [data]); // THIS IS THE ONLY
CHANGE
        };

        $.ajax({
            type:"POST",
            url: this.options.url,
            success: successHandler
        });
    }
});

It's not perfect, but at least I won't have to worry about any changes to
the widget outside the trigger event. I think it would be awesome if the
Tapestry JS would use more Pub/Sub as opposed to me having to hack a widget,
but then again, I am using the jQuery version over Prototype and those
events may have been deleted (so what do I know!).

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-Updated-Event-tp5510722p5514243.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to