Are you adding the script before adding the form to which you wish to
add behavior?  Can you add it after?  I use scripts to add behavior to
the onSubmit and have never had this issue.  The only thing I can
think of to explain it is that I add the script after the form.  May
not have anything to do with it, but it's worth a shot.

-Mike

On 4/12/06, Kevin C. Dorff <[EMAIL PROTECTED]> wrote:
> I am just moving my application from Tapestry 3.0.3 to 4.0.1. I have
> overcome a ton of roadblocks and am figuring all the changes out, but,
> wondered of somebody can suggest a more elegant solution to a problem
> I am having.
>
> I want to inject a bit of logic during a forms onSubmit. Before I
> could just add onSubmit to the <form> and it would be called. Now
> onSubmit is a reserved word for the Form component, so I can't use it.
> After some searching, I found Tapestry.onsubmit(form,function). All of
> the examples show putting it in the .script file (for me, I am using
> the Page's script file which I am including using the Script
> component) within the <initialization> block, but, if I do that when
> the page that is generated looks like
>
>   Tapestry.onsubmit('form', myfunction);
>
>   Tapestry.register_form('form');
>   Tapestry.set_focus('queryField');
>
> so because the onsubmit is before the Tapestry.register_form it doesn't 
> trigger.
>
> I solved this by creating a new method and adding to the <initialization>
>
>   block window.onload = registerSubmitCallback;
>
> defining in the body of the script file
>
>   function registerSubmitCallback() {
>      Tapestry.onsubmit("form", appendParams);
>   }
>
> This does work, but, feels REALLY inelegant. Isn't there a better way
> to do this?
>
> Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to