View Single Post
Old 11-20-08, 07:09 PM   #13
jcrox
Mahna Mahna
 
jcrox's Avatar
 
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,134
Default Re: Need some help making medical website

For checking to make sure form fields are filled in I usually use JavaScript.

example:

<html>
<head><title>Form Validation Example</title>
<script language="JavaScript">

function checkField1() {
var valid = true;
var value = document.getElementById("field1").value;
if(value == "" || value == null) {
alert("You didn't enter a value in Field 1");
valid = false;
}
return valid;
}

function checkField2() {
var valid = true;
var value = document.getElementById("field2").value;
if(value == "" || value == null) {
alert("You didn't enter a value in Field2");
valid = false;
}
return valid;
}


function validateForm() {
var valid = true;
valid = checkField1() && checkField2();
return valid;
}
</script>
</head>

<body>
<form method="post" onSubmit="validateForm();">
<input type="text" name="field1" id="field1" />
<input type="text" name="field2" id="field2" />
<input type="submit" value="submit" />
</form>
</body>
</html>
__________________

Gaming

MSI MPower Z87 | 4770k | CNPS9900MAX-B | 8GB G.Skill 1866 | EVGA GTX760 |ThermalTake 850w | X-Fi Titanium | HAF | Asus PA248Q | Lycosa | Death Adder | Win8 Pro 64

Dev/Backup

MSI GD65 | 2500k | H50 | 8GB G.skill | GTX570 | Ubuntu 13.10

Laptop

17" Inspiron | i5 | 4GB DDR3 | 500GB HDD | Win7 Pro 64

jcrox is offline   Reply With Quote