Code: Select all
<form name="configChange" action="configUpdate.php" method="post" onSubmit="return ValidateForm()">
//email address section added here, which works fine //
CONFIG:</br>
first warning after:
<?php
print "<select name=\"timesmallH\">";
for($a = 0; $a <13; $a++) {
print "<option value=$a>$a</option>";
}
print "</select> Hours";
print "<select name=\"timesmallM\">";
for($a = 0; $a <61; $a++) {
print "<option value=$a>$a</option>";
};
print "</select> Minutes";
?>
</br>
Second warning after:
<?php
print "<select name=\"timelargeH\">";
print "<option Selected=\"selected\" value=\"$timelargeH\">$timelargeH </option>";
for($a = 0; $a <13; $a++) {
print "<option value=$a>$a</option>";
}
print "</select> Hours";
print "<select name=\"timelargeM\">";
print "<option Selected=\"selected\" value=\"$timelargeM\">$timelargeM </option>";
for($a = 0; $a <61; $a++) {
print "<option value=$a>$a</option>";
};
print "</select> Minutes";
?>
</br>
</br>
<input type="Submit" value="Save Changes"/>
</form>
I then want to write some javascript to check that the first one is less than the second one.
I have the following javascript:
Code: Select all
function ValidateForm(){
var emailAddress=document.configChange.emailAddress
var timesmallH=document.configChange.timesmallH
var timesmallM=document.configChange.timesmallM
var timelargeH=document.configChange.timelargeH
var timelargeM=document.configChange.timelargeM
var timesmallSEC = ((timesmallH * 60 * 60) + (timesmallM * 60))
var timelargeSEC = ((timelargeH * 60 * 60) + (timelargeM * 60))
if ((emailAddress.value==null)||(emailAddress.value=="")){
alert("Please Enter an Email Address")
emailAddress.focus()
return false
}
if (timesmallSEC.value > timelargeSEC.value){
alert("warning text goes here")
timesmallH.focus()
return false
}
return true
}