A little background: I need to wire-up some custom JavaScript to be launched
when the Submit button of my form is clicked. I now believe that the best
way to do this with Tapestry5 is to use the Event.observer for this purpose.
Unfortunately my knowledge of client-side javascript, scriptaculous, etc, is
limited, and I can't make this work. The issue seems to be that my form is
within a t:block that gets injected into a t:zone dynamically.

So, even if I do this in my JS file:

Event.observe(window, 'load', function() 
{
        Event.observe('formTranslator', 'submit', function() 
        {
            // some onsubmit actions
        });
});

this will fail, because apparently, the my form named formTranslator doesn't
exist at the point the document is loaded (the form gets reinjected into the
t:zone whenever a new object to translate is selected by the user). The
JavaScript error that I see in my JS console is this:

"element is null" -> scriptaculous/prototype.js Line:3936

I guess I somehow need to have the Event.observer called everytime the form
is reinjected into the t:zone, but how? Are my assumptions correct at all?

Thanks for any ideas in advance!

Rado
-- 
View this message in context: 
http://old.nabble.com/T5%3A-Using-Event.observer-with-a-form-within-a-t%3Ablock-tp28697334p28697334.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