i have written a generic function to check if the fields are empty or not in the page. Now the problem is that i want check for multiple empty fields. I really don't know how can i modify the below function to incorporate this. Please help
function checkIfEmpty(formNo,elementName,alertMessage,location)
{
if (document.forms[formNo].elements[elementName].value==""
{
alert(alertMessage);
return false;
}
else{
window.location=location;
return true;
}
}
function checkIfEmpty(formNo,elementName,alertMessage,location)
{
if (document.forms[formNo].elements[elementName].value==""
{
alert(alertMessage);
return false;
}
else{
window.location=location;
return true;
}
}