XSL ファイルにフォーム要素があります。チェックボックスをオンにして [送信] ボタンを有効にするために、同じ XSL ファイルに JavaScript 関数が必要です。
ここにフォームがあります -
<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>
読み取っている XML コンテンツは次のとおりです。
<content name = "chkbox">
Yes, I understand and agree to the T&C.
</content>
javascript の問題に直面しています。エラーが発生します。チェックボックスをクリックして関数が呼び出されているかどうかを確認するアラートを設定しました。
ここに私が使用しているコードがあります -
<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>
このエラーが発生します....
org.xml.sax.SAXParseException: illegal top-level element