I have two text boxes in a form. When the user clicks Submit, I want to make sure both of those fields contain values. If they don't, I want an alert to pop up.
function validate(frm)
{
var boo=true;
if(frm.name.value==""
{
boo=false;
alert("Please enter a name."
}
if(frm.age.value==""
{
boo=false;
alert("Please enter an age."
}
return boo;
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.