Validation
I am using a required field validator along with a drop down list which was in a panel and that panel enable only with a checkbox's checked event, sometimes i don't want to check it ,then on submitting the page gives validation error , how can i solve this?plz help me frnds
Anil KumarPosted May 22, 2012, 7:17 AM
function toggleValidator(chk)
{
var validatorId= document.getElementById("myValidatorId");
ValidatorEnable( validatorId, chk.checked);
}
OR using jQuery
$('[id$=chkboxId]').click(function(){
$('[id$=myValidatorId]').attr('disabled',!this.checked);
});
and paste it inside this body to bind it when DOM is ready.
$(document).ready( function(){
.........
....
});
SLDeveloperPosted May 22, 2012, 5:42 AM
Right now, your just making visiblity of panel disable/enable but Validator at control is enable.
make validator disable default & when you checked the check box that time enable the validator if unchecked viceversa.
hope this helps
nishant ranjanPosted May 22, 2012, 5:39 AM
and on checkbox changed event set the dropdown.causevalidation=true