Strangeplant
09-17-2008, 07:30 PM
I'm totally missing something, and believe me when I say that I have tried.....
I have a check box in a form in a PHP script, and when checked, it needs to clear four other text input fields. So, I'm going to use javascript, but..... The form looks like this:
<form id="globe" name="aoiselect" method="post" action="<? echo $_SERVER['PHP_SELF'];?>">
<tr>
<td>Select AOI:
<select onchange="window.location='index.php?satellite='areaaoi='+this.value">
<?
for ($j = 0; $j <= $d2[$sat]; $j++) { // $j must be the # of elements in array group
?> <option value="<?=$j?>" <? if ($aoi == $j) { print "SELECTED";}?>> <?=$d1[$sat][$j][0]?></option><?} // write array to input fields below
?>
</select> or Define AOI:
<td>lat N: <input type="text" id="ordN" name="ordN" size="6" value="<?=$d1[$sat][$aoi][1] ?>"> </td>
<td>lon E: <input type="text" id="ordE" name="ordE" size="6" value="<?=$d1[$sat][$aoi][2] ?>"> </td>
<td>lat S: <input type="text" id="ordS" name="ordS" size="6" value="<?=$d1[$sat][$aoi][3]?>"> </td>
<td>lon W: <input type="text" id="ordW" name="ordW" size="6" value="<?=$d1[$sat][$aoi][4]?>"> </td>
<td>Whole Scan: <input type="checkbox" name="wholeScan" value="wholeScan" onFocus="setWholeScan(this)";></td>
</tr>
</form>
Then I have some javascript that goes with the onfocus:
function setWholeScan() {
if (document.aoiselect.wholeScan.checked) {
document.aoiselect.ordN.value = "";
document.aoiselect.ordE.value = "";
document.aoiselect.ordS.value = "";
document.aoiselect.ordW.value = "";
}
}
But, it doesn't work, nor any variation that I can think of..... So, what am I missing? I'm still building the program, and there is another, more troublesome problem to come, which I just might be able to solve if I can get this working. Please ignore the lack of submit button, and the post.....
I have a check box in a form in a PHP script, and when checked, it needs to clear four other text input fields. So, I'm going to use javascript, but..... The form looks like this:
<form id="globe" name="aoiselect" method="post" action="<? echo $_SERVER['PHP_SELF'];?>">
<tr>
<td>Select AOI:
<select onchange="window.location='index.php?satellite='areaaoi='+this.value">
<?
for ($j = 0; $j <= $d2[$sat]; $j++) { // $j must be the # of elements in array group
?> <option value="<?=$j?>" <? if ($aoi == $j) { print "SELECTED";}?>> <?=$d1[$sat][$j][0]?></option><?} // write array to input fields below
?>
</select> or Define AOI:
<td>lat N: <input type="text" id="ordN" name="ordN" size="6" value="<?=$d1[$sat][$aoi][1] ?>"> </td>
<td>lon E: <input type="text" id="ordE" name="ordE" size="6" value="<?=$d1[$sat][$aoi][2] ?>"> </td>
<td>lat S: <input type="text" id="ordS" name="ordS" size="6" value="<?=$d1[$sat][$aoi][3]?>"> </td>
<td>lon W: <input type="text" id="ordW" name="ordW" size="6" value="<?=$d1[$sat][$aoi][4]?>"> </td>
<td>Whole Scan: <input type="checkbox" name="wholeScan" value="wholeScan" onFocus="setWholeScan(this)";></td>
</tr>
</form>
Then I have some javascript that goes with the onfocus:
function setWholeScan() {
if (document.aoiselect.wholeScan.checked) {
document.aoiselect.ordN.value = "";
document.aoiselect.ordE.value = "";
document.aoiselect.ordS.value = "";
document.aoiselect.ordW.value = "";
}
}
But, it doesn't work, nor any variation that I can think of..... So, what am I missing? I'm still building the program, and there is another, more troublesome problem to come, which I just might be able to solve if I can get this working. Please ignore the lack of submit button, and the post.....