cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Portier <>
Subject Re: cforms forms_onsubmit()
Date Mon, 23 Aug 2004 07:37:02 GMT

I hope you're not serious on wanting to override: there are (well could 
be) functions that cforms really need to be called.

Now, since of course you're likely to have some functions you want to 
call as well, there has been a provisioning for this through the use of 
so called on-submit handlers (functions you can register to be called on 

Here is how you do it:

by some magic (xslt most probably) you need to make sure you include 
something like the following in the resulting html-page:

   <script language="javascript">
       // making my on-submit...
       var myFSHandler = new Object();
       myFSHandler.forms_onsubmit = function() {

       // registring your on-submit
       forms_onsubmitHandlers[forms_onloadHandlers.length] = myFSHandler;

the same pattern exists for 'on_load' of the form-page (allowing to 
initialize some stuff)

for the machinery behind this, pls check:
(search for onsubmit and onload)


Jorg Heymans wrote:

> Jorg Heymans wrote:
>> Hi,
>> Is it possible to fully override the onsubmit handler that is 
>> generated by cforms? Cocoon allways puts a forms_onsubmit() infront of 
>> whatever i put in the handler of the form template, causing my 
>> javascript code not to be executed upon submit. The whole of google 
>> has only 2 references to forms_onsubmit() so i am really wondering 
>> what this thing actually does.
> Thanks to the very active google-spider, google now contains 5 
> references to forms_onsubmit() :-)
> Anyone have a clue what this thing actually does?
> my
> <ft:form-template onsubmit="alert('hello')">
> is transformed by cforms to
> <form onsubmit="forms_onsubmit(); alert('hello');">
> causing the alert function not to be executed anymore...
> Regards
> Jorg Heymans
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Marc Portier                  
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                          

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message