This project is read-only.

javascript in form

Jan 18, 2011 at 10:58 AM


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

Jan 18, 2011 at 11:07 AM


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>