I have a form element in an XSL file. I want to have a JavaScript function in the same XSL file to enable the Submit button on checking a check box.
Here is the form -
<form action="NewUserNavigation" method="post" name="NewUserNavigationForm">
<input name="eventName" type="hidden" value="NewUserNavigationEvent"/>
<div class="sansIcon">
<input type="checkbox" name="chk" onClick="EnableSubmit()"><xsl:apply-templates select="content[@name='chkbox']" mode="impl_expandContent"/></input>
</div>
<div class="buttonBarPage">
<input name="Submit" class="primary" type="submit" value="Continue" disabled="true"/>
</div>
</form>
Here is the XML conetent that it is reading -
<content name = "chkbox">
Yes, I understand and agree to the T&C.
</content>
I am facing problem with the javascript, it gives error. I have put an alert to check if the function is being called on click of the checkbox.
here is the code I am using -
<script type="text/javascript">
function EnableSubmit()
{
alert("test");
if(document.NewUserNavigationForm.chk.checked==true)
{
document.NewUserNavigationForm.Submit.disabled=false;
}
if(document.NewUserNavigationForm.chk.checked==false)
{
document.NewUserNavigationForm.Submit.enabled=false;
}
}
</script>
I get this error....
org.xml.sax.SAXParseException: illegal top-level element