I have created a form that has fields that I made required. I want to create a popup message when the required fields are not filled in. Can someone please show me how to do this or direct me in the right direction. Thanks.
« | September 2009 | » | ||||
![]() |
||||||
S | M | T | W | T | F | S |
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
I have created a form that has fields that I made required. I want to create a popup message when the required fields are not filled in. Can someone please show me how to do this or direct me in the right direction. Thanks.
Thursday, 17 September 2009 - 6:02 PM EDT
Name: diabloclan60
This is what I found so far but I'm not sure how to do this with multiple fields.
Example:
<html>
<head>
<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(email,"Email must be filled out!")==false)
{email.focus();return false;}
}
}
</script>
</head>
<body>
<form action="submit.htm" onsubmit="return validate_form(this)" method="post">
Email: <input type="text" name="email" size="30">
<input type="submit" value="Submit">
</form>
</body>
</html>