-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: atrehan
Message 2 in Discussion
Hi, This is a tricky thing to do, but achiveable. The way you have disabled
the validation control is fine, it disables the control when you call that
function and allows the page to be posted back, but as soon as your page gets
posted back, the entire life cycle of the page starts again and the control
again becomes active and shows the error. So you have to write two functions
one for disabling the javascript and another for checking if your control is
enabled or disabled on the page load. The Code goes like this You have to
declare one hidden variable on the page for storing the state of your control.
I have used a variable names val for the same purpose <input type="hidden"
id="val"> 'Function for enabling and disabling the control 'If we pass the
variable temp as 0 then our validator control i.e. "Validator1" will be
disabled 'If we pass the variable temp as 1 then the validator control will be
enabled 'validator1 is the required field validator function
changeStatus(temp) { if (temp==0){
ValidatorEnable(document.getElementById("validator1"), false);
document.Form1.val.value=0; } else{
ValidatorEnable(document.getElementById("validator1"), true);
document.Form1.val.value=1; } } 'This is the function that will be
added to the page load i.e. in the body tag for the event
onLoad="checkStatus();" function checkStatus(){ if
(document.Form1.val.value==0)
ValidatorEnable(document.getElementById("validator1"), false); else
ValidatorEnable(document.getElementById("validator1"), true); } This
will check the value of the hidden control on page load. If the value is 0 then
we know our control is disabled and if it is 1 then we know the control is
enabled as we havbe set the values of the hidden control when we have disabled
or enabled the validator control. Please provide your comments. Thanks,
Amit Trehan
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]