You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Mark Lundquist <ml...@wrinkledog.com> on 2004/03/17 06:35:41 UTC

[cforms] window onload handler

Hello Cocoon dev-dudes,

Believe it or not, people may sometimes still want or need to do some 
client-side Javascript stuff... :-)

I set a window.onload handler in some client-side Javascript, but it 
got stomped by the
	<body onload="forms_onload">
added by the forms stylesheet.

I worked around by hacking forms-lib.js:

	var onloadSaved = window.onload;
	function forms_onload() {
		if (onloadSaved) {
			onloadSaved();
		}
		.
		. // etc...
		.
	}

Is there any reason this shouldn't just be added to forms-lib.js?

Very best regards,
Mark


Re: [cforms] window onload handler

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Mark Lundquist wrote:

> Hello Cocoon dev-dudes,
>
> Believe it or not, people may sometimes still want or need to do some 
> client-side Javascript stuff... :-)
>
> I set a window.onload handler in some client-side Javascript, but it 
> got stomped by the
>     <body onload="forms_onload">
> added by the forms stylesheet.


Works here - due to:
  <xsl:template match="body" mode="forms-field">
    <xsl:attribute name="onload">forms_onload(); <xsl:value-of 
select="@onload"/></xsl:attribute>
  </xsl:template>

in the stylesheet.


Vadim