-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: Rohit_BD
Message 2 in Discussion

Unfortunately, since all buttons are emitted as "Submit" buttons, we find that the 
validation will occur for all button controls, and it's only possible to 
enable/disable validation caused by the buttons and not selectively fire required 
field validators depending on the button. There is a way though, and that is using 
CustomValidators instead of required field validators. This is how it's done:   Say 
you have 2 buttons btn1 & btn2. btn1 causes validation for textbox txt1 and btn2 
causes validation for textbox txt2. Now, create 2 custom validators for each text box, 
say cv1 for txt1 and cv2 for txt2. Specify the client-functions for each custom 
validator, say fnValidate1() and fnValidate2() respectively -   <script> function 
fnValidate1(args, isValid) {    //validate txt1 for empty.    
if(document.forms[0].txt1.value.replace(" ", "").length == 0)    {       isValid = 
false;     }     else     {        isValid = true;     } }    function 
fnValidate2(args, isValid) {    //validate txt2 for empty.    
if(document.forms[0].txt2.value.replace(" ", "").length == 0)    {       isValid = 
false;     }     else     {        isValid = true;     } } </script>   That's all to 
it. Now the validators will fire only for the fields that are supposed to be validated 
depending on the button pressed.   Note: The replace() function above needs the 
parameter for global search and replace (regExp object) instead of the strings as 
shown, I have shown it that way just for the sake of explaining.

-----------------------------------------------------------

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]

Reply via email to