Is there a way to inject js into a form's OnSubmit event?

A place for discussion about skinning and design. Before posting questions here you should review the documentation about creating skins.

This thread is closed to new posts. You must sign in to post in the forums.
2/10/2012 3:44:24 PM
Gravatar
Total Posts 4

Is there a way to inject js into a form's OnSubmit event?

I've been working on an existing instance of mojoPortal and learning a great deal as I go.  I have a request to implement tracking of users when hitting the submit button on specific forms.  I can put the js lib references into the layout.master page, but need to get at specific occurrences of the form submit behavior for specific forms.  I was hoping that I could do this from a SiteAdmin or SkinDesign type of approach and not have to customize the source behind mojo, but have not found anything on searches into the forums and documentation.  Am I missing something?

thanks

2/14/2012 12:26:14 PM
Gravatar
Total Posts 4

Re: Is there a way to inject js into a form's OnSubmit event?

Is the answer creating a custom submission handler via Form Wizard Pro?  I was hoping that I could find a way to inject some minor js into the submit event via the HTML editor.

2/14/2012 3:51:42 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Is there a way to inject js into a form's OnSubmit event?

Joe Audette is out on vacation this week, so I'll try to give you some "bronze" level support until he's back. I'm not a JS expert, but it may be possible to put your JavaScript code into a separate HTML instance on the page. I'd think the problem in that case would be reliably identifying and processing the fields and buttons of the form at runtime. You may also have an issue because there could already be a javascript onsubmit function tied to the form submit button for field validations. I don't know if you're allowed to define two onsubmit functions on a page.

Now, if you are able to write your own custom submission handler, then you will definitely have full power to do any post processing you need to. As a bonus, the submit post-processing can be done on the server side, and therefore it wouldn't break if the client has JavaScript disabled for some reason.

Hope that helps.

Jamie

You must sign in to post in the forums. This thread is closed to new posts.