There is a submit button within the form. I could not attach the code
in onclick handler because I want it to run only if the form is valid.

2009/12/22 Ashwanth Kumar <ashwanth.ku...@gmail.com>:
> 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
>

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

Reply via email to