I am facing a strange programming problem.
I've a page for user registration. I am using JavaScript code to disable text boxes when user selects no from option.
But after the selecting Option 'No' from drop down list, page is not getting submitted and not redirecting to next page.
And surprisingly, if I select every 'Yes' & fill text box, then it submits smoothly and redirect to next page.
I suspect this is JavaScript problem. Need help please !
Here is my javasctipt code sample
function DisableEnable2() {
var ddlCnovict = document.getElementById("<%= ddlConviction.ClientID %>")
var txtConDate = document.getElementById("<%= txtConvictDate.ClientID %>")
var txtConDetail = document.getElementById("<%= txtConvictionDetails.ClientID %>")
if (ddlCnovict.options[ddlCnovict.selectedIndex].text == "No") {
txtConDate.disabled = true;
txtConDetail.disabled = true;
}
else {
txtConDate.disabled = false;
txtConDetail.disabled = false;
}
}
Asp code:
Yes No