javascript in form

Jan 18, 2011 at 9:58 AM

Hello,

How is it possible to include form javascript bij onclick?

i've got the following input tag:

<input type="checkbox" name="privacy" onclick="if (this.checked==true) {documetn.getElementById('btnsubmit').disabled=false}"/>

the parser gives a error on documetn.getElementById

Coordinator
Jan 18, 2011 at 10:07 AM

Hi,

Inside attributes, you must use double curly brackets to render single ones. the following is correct:

<input type="checkbox" name="privacy" onclick="if (this.checked==true) {{document.getElementById('btnsubmit').disabled=false;}}"/>

This is because XSLT assumes that insde XML attribute curly braces setup a transformation template.

_______
Or, you can use xsl:attribute:

<input type="checkbox" name="privacy">
   <xsl:attribute name="onclick"> if (this.checked==true) { document.getElementById('btnsubmit').disabled=false; } </xsl:attribute>
</input>