On 28 Dec 2006, at 12:01, Jeremy Quinn wrote:


And does the new stuff better support multiple forms on one page. I
think there are some problems with the current onsubmit handlers when
there is more than one form.

Yes, I had to change the API for adding submit handlers to allow for more than one form per page.

Instead of this :

        forms_onsubmitHandlers.push(handler)

You would have to do this :

        cocoon.forms.addOnSubmitHandler(formID, handler)

A quick correction, the new function is this :

cocoon.forms.addOnSubmitHandler = function(elt, handler)

Where 'elt' is the Element that is adding the handler.


cocoon.forms.addOnSubmitHandler = function(elt, handler) {
    if (typeof(handler.forms_onsubmit) == "function") {
        var form = this.getForm(elt);
        if (form) {
            var id = form.getAttribute("id");
            if (id) {
if (!cocoon.forms.onSubmitHandlers[id]) cocoon.forms.onSubmitHandlers[id] = new Array();
                cocoon.forms.onSubmitHandlers[id].push(handler);
            } else {
if (dojo) dojo.debug("WARNING: SubmitHandler not added. There is no id attribute on your form.");
            }
        }
    }
}


regards Jeremy

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to