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

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: Rohit_BD
Message 4 in Discussion

 I have modified the functions slightly. 
<script> var btn = "";   function setButton(btnName) {     btn = btnName; }   function 
isEmpty(expression) {
    if(expression.length <= 0) return true;   
 
    for(var i = 0; i < expression.length; i++)
    {
        if(expression.charAt(i) != " ") return false;
    }
    
    return true;
} function fnValidate1(args, isValid) {     if(btn == "btnSearch") //suppress 
validation due to search    {         args.isValid = true;         return;     }      
//validate txt1 for empty.    if(isEmpty(document.forms[0].txt1.value))    {       
isValid = false;     }     else     {         //Check for number
        if(isNaN(document.forms[0].txt1.value))         {              isValid = 
false;         }         else         {              isValid = true;          }     } 
}    function fnValidate2(args, isValid) {     if(btn == "btnSubmit") //suppress 
validation due to submit    {
        args.isValid = true;         return;     }      //validate txt2 for empty.    
if(isEmpty(document.forms[0].txt2.value))    {       isValid = false;     }     else   
  {         //Check for number         if(isNaN(document.forms[0].txt2.value))         
{              isValid = false;         }         else         {              isValid 
= true;          }    } } </script> <body> <form runat="server"...> <asp:TextBox 
id="txt1" runat="server"/> <asp:CustomValidator id="cvTxt1" controlToValidate="txt1" 
clientFunction="fnValidate1"/><br><br>  <asp:TextBox id="txt2" runat="server"/> 
<asp:CustomValidator id="cvTxt2" controlToValidate="txt2" 
clientFunction="fnValidate2"/><br><br> <asp:button id="btnSubmit" runat="server" 
Text="Submit">  <asp:button id="btnSearch" runat="server" Text="Search"> </form> 
</body> Code behind: private void Page_Load(...) {    ....    
btnSubmit.Attributes.Add("onclick", "setButton('btnSubmit'));    
btnSearch.Attributes.Add("onclick", "setButton('btnSearch'));    .... }

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

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