this is my validation code & i want to print all error msg's in single alert box.
please can any one send me the code 4 that
please can any one send me the code 4 that
Code:
function validate_grid(value,id,ind)
{
var err_str="";
if(ind==1 || ind==2)
{
var patt=/^([0-9]|[0][0-9]|[1][0-9]|[2][0-3])[:\.]{1} [0-5][0-9]$/;
if(!patt.test(value))
{
mygrid.setCellTextStyle(id,ind,"background-color:yellow;");
if(err_str!="")
err_str+="\n"+(ind+1)+". Enter numbers and : only";
else
err_str=(ind+1)+".Enter numbers and : only";
alert(err_str);
return false;
}
else
{
mygrid.setCellTextStyle(id,ind,"background-color:white;");
return true;
alert(err_str);
}
}
else if(ind==3 || ind==4)
{
var patt=/^[0-9]+[\.]?[0-9]{0,2}$/;
if(!patt.test(value))
{ mygrid.setCellTextStyle(id,ind,"background-color:yellow;");
if(err_str!="")
err_str+="\n"+(ind+1)+". Enter floating type values only........";
else
err_str=(ind+1)+".Enter floating type values only........";
alert(err_str);
return false;
}
else
{
mygrid.setCellTextStyle(id,ind,"background-color:white;");
return true;
alert(err_str);
}
}
else if(ind==6)
{
var patt=/^[0-9]{2}[\-][a-z]{3}[\-][0-9]{4}$/i;
if(!patt.test(value))
{
mygrid.setCellTextStyle(id,ind,"background-color:yellow;");
if(err_str!="")
err_str+="\n"+(ind+1)+".Enter Date";
else
err_str=(ind+1)+".Please enter Date";
alert(err_str);
return false;
}
else
{
mygrid.setCellTextStyle(id,ind,"background-color:white;");
return true;
alert(err_str);
}
}
}
Comment