Solution
So, while hiding the
div
, you need to disable the
Validators
present inside that
div
. Otherwise, the Validators will not allow you to do any task.
There is a
javaScript
method
ValidatorEnable(val, enable)
, which I always use.
Refer -
ASP.NET Validation in Depth-> Client-Side Validation[
^].
You will find the documentation of this method.
Example
Let's consider one
div
, which you are hiding in you code, that is
AcquiringBankListDiv
.
Inside this div, you have
RequiredFieldValidator
Validator
AcqBankListReqFielValid
.
So, your code will be modified as below.
$('#radOurBankATM').focus(function()
{
$('#AcquiringBankListDiv').hide();
$('#AcquiringBankListDiv').css("display", "none");
ValidatorEnable(document.getElementById('AcqBankListReqFielValid'), false);
$('#txtAcquiringBank').val('Corporation Bank');
$('#fake_txtAcquiringBank').hide();
$('#txtAcquiringBank').show();
$('#AcquiringBankDiv').show();
$('#AcquiringBankDiv').css("display", "block");
});
Note
Don't forget to Enable the
Validators
, whenever necessary (while showing the
divs
), like below.
ValidatorEnable(document.getElementById('AcqBankListReqFielValid'), true);
So, modify your code accordingly for all the
divs
and their respective
Validators
.