Saturday, February 23, 2008

Javascript Validation the CheckBox List:

The below code Validate the CheckBox list whether any one of the items are checked or not.

Name of the CheckBox list is : chkFunctionType

function fnValidate()
{
var flag=false;
var chkListfunction = document.getElementById ("chkFunctionType");
var arrCheckbox= chkListfunction.getElementsByTagName("input");
for(var i=0;i {
if(arrCheckbox[i].checked==true)
{
flag=true;
}
}
if(flag==false)
{
alert('Please select the Function Level');
return false;
}
}

Call this Function in the Button Click.

No comments: