Skip to content Skip to sidebar Skip to footer

How To Implement A Required Validation To Check If The User Enter Atleast One Value

I have the following view inside my asp.net mvc web application, to do a search based on the entered IP AND/OR MAC :- @using (Ajax.BeginForm('AdvanceSearchIndex','Home', new AjaxOp

Solution 1:

Validate IP: http://jsfiddle.net/kDXmd/

functionValidateIPaddress(ipaddress)   
{  
 if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress))  
  {  
    return (true)  
  }  

    return (false)  
} 

mac address http://jsfiddle.net/vY95y/:

functionmacAddressValidation(macAdd) 
 {
  varRegExPattern = /^[0-9a-fA-F:]+$/;

  if (!(macAdd.match(RegExPattern)) || macAdd.length != 17) 
  {
   returnfalse;
  }
  else
  {
   returntrue;
  }
 }

Post a Comment for "How To Implement A Required Validation To Check If The User Enter Atleast One Value"