Link to home
Start Free TrialLog in
Avatar of Sukeshjph
Sukeshjph

asked on

I want to disable Required field validation by javascript.

I want to make 2 required field validators disabled on clicking of one checkbox.I tried a lot by putting like this
var vVal = document.getElementById('<%=rfvForPriceFrom.ClientID%>');
vVal.IsValid=true;
and many otherway..but stll validation summary shows the  respective errormessage
how to avoid it.
ASKER CERTIFIED SOLUTION
Avatar of ZachSmith
ZachSmith
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sukeshjph
Sukeshjph

ASKER

please give me code...don't show me your logic..i know that too....even google also i could search that....my job is to disable the required field validators inside a javascript function..i tried by validatorenable method but in vain...
this is how i solved my issue without custom validator

function CheckForPriceFields()
{
debugger
var Check=document.getElementById('<%=chkcontactforprice.ClientID %>').checked;


var from=document.getElementById('<%=txtpricefrom.ClientID%>');
var To=document.getElementById('<%=txtpriceto.ClientID%>');
if(Check==true)
{
from.value="";
To.value="";
from.disabled=true;To.disabled=true;
var PriceFrom =document.getElementById('<%=rfvForPriceFrom.ClientID%>');
var Priceto=document.getElementById('<%=rfvForPriceto.ClientID%>')
ValidatorEnable(PriceFrom,false);
ValidatorEnable(Priceto,false);
}
else
{
from.disabled=false;
To.disabled=false;
}

}