Hello:
I am trying to modify existing pages. I just added in a search capaibility to the page. This page rather complicate and lengthy to me. This page is using <ajaxToolkit:modal>
to process information. Everything is working fine except when
I have the JavaScript function ensureChecked() added to validate the checkbox making sure the user clicks on the checkbox before proceed to submit this causes the search capaiblity not to work. Is there work around this with out the need of JavaScript function ensureChecked() being called from <asp:CustomValidator> but still achieve what I want? Let me know if this confuses you....Thanks.
<script type="text/javascript">
function ensureChecked(source, args) {
var cb = document.getElementById('<%=cbxAgreement.ClientID%>');
if (cb.checked == true) {
args.IsValid = true;
} else {
args.IsValid = false;
}
}
</script>
<aspanel ID="pnlEnrollmentAgreement" runat="server" Width="400px" Height="300px"
Style="display: none">
<table>
<tr>
<td align="left" valign="top">
<asp:Label ID="lbAgreementHeader" runat="server" Width="100%" BackColor="#E2E3C2"
ForeColor="Black" CssClass="linkStyle" Font-Size="14px" Text="<b>Step 3</b> - Enrollment Agreement"></asp:Label>
</td>
</tr>
<tr>
<td align="left">
<asp:CheckBox ID="cbxAgreement" runat="server" Text="I have received pre-enrollment counseling and will notify the appropriate training." /><br />
<br />
<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ensureChecked"
ErrorMessage="* Please read then check the agreement to continue"></asp:CustomValidator><br />
<br />
<br />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:Button ID="btnSubmit" runat="server" Text="Enroll in this Course!" OnClick="btnSubmit_OnClick" />
</td>
</tr>
</table>
</aspanel>
I am trying to modify existing pages. I just added in a search capaibility to the page. This page rather complicate and lengthy to me. This page is using <ajaxToolkit:modal>
to process information. Everything is working fine except when
I have the JavaScript function ensureChecked() added to validate the checkbox making sure the user clicks on the checkbox before proceed to submit this causes the search capaiblity not to work. Is there work around this with out the need of JavaScript function ensureChecked() being called from <asp:CustomValidator> but still achieve what I want? Let me know if this confuses you....Thanks.
<script type="text/javascript">
function ensureChecked(source, args) {
var cb = document.getElementById('<%=cbxAgreement.ClientID%>');
if (cb.checked == true) {
args.IsValid = true;
} else {
args.IsValid = false;
}
}
</script>
<aspanel ID="pnlEnrollmentAgreement" runat="server" Width="400px" Height="300px"
Style="display: none">
<table>
<tr>
<td align="left" valign="top">
<asp:Label ID="lbAgreementHeader" runat="server" Width="100%" BackColor="#E2E3C2"
ForeColor="Black" CssClass="linkStyle" Font-Size="14px" Text="<b>Step 3</b> - Enrollment Agreement"></asp:Label>
</td>
</tr>
<tr>
<td align="left">
<asp:CheckBox ID="cbxAgreement" runat="server" Text="I have received pre-enrollment counseling and will notify the appropriate training." /><br />
<br />
<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ensureChecked"
ErrorMessage="* Please read then check the agreement to continue"></asp:CustomValidator><br />
<br />
<br />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:Button ID="btnSubmit" runat="server" Text="Enroll in this Course!" OnClick="btnSubmit_OnClick" />
</td>
</tr>
</table>
</aspanel>