On Tue, Dec 22, 2009 at 6:14 PM, Kenneth CH, LEE <klch...@gmail.com> wrote:

> Hi there,
>

Hello,


>
> Is there any existing facilities to trigger some custom Javascript
> code _after_ validating the form?
>
> I'm now doing it with some Javascript tricks:
> ===============
> <form t:type="form" t:id="myform">
> ...
> <script type="text/javascript">
> Event.observe(window, "load", function() {
>    var f = $("myform").onsubmit;
>    $("myform").onsubmit = function(e) {
>        return f(e) && customFunction();
>    };
> });
> </script>
> </form>
> ...
> <script type="text/javascript">
> function customFunction() {
>  //return true to submit
> }
> </script>
> ===============
>

When exactly do u submit ur form??


> Notice that the custom function is only called _after_ validation
> _and_ only if it was successful.
>

Well, if  you want to do a custom JS, u can do a Zone Update of the Form,
then observe Tapestry.ZONE_UPDATED_EVENT, for doing some some custom JS!
But, that happens only after form submission and not before that!

HTH
 - Ashwanth Kumar

Reply via email to