Thanks for your interest!
I added the alert() statements and found that the correct values were reported on the first page. I also added the statement
print_r($_POST); to the second page and found that the same fields, as expected, were undefined when set with JavaScript. When I set the fields manually, entering numbers in each field, their values were reported successfully by the same
print_r($_POST); statement.
The name of the form is indeed
addRecord. Here is the form; the lines of interest (though I realize line numbers are not displayed) are:
13: where the form begins
43-46: where the month, day and year fields are declared, as well the checkbox that calls the JavaScript function setDefaultExpiration() when clicked.
Code: Select all
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script type="text/javascript" src="JavaScript_functions.js"></script>
</head>
<body onload="enableTextFields()">
<?php include('header.html'); ?>
<div id="content">
<form name="addRecord" action="add_record_conf.php" method="POST">
Indicate the person whose authority is being delegated:
<br />
<select name="primary">
<option value="">(select)</option>
<option value="Johnson, Jay A">Johnson, Jay A</option>
<option value="Stiner, Bryan D">Stiner, Bryan D</option>
<option value="Oliver, Thomas E">Oliver, Thomas E</option>
<option value="Chacon, Jean P">Chacon, Jean P</option>
<option value="Williams, Greg S">Williams, Greg S</option>
</select>
<input name="primaryIsSubmitter" type="checkbox" />Check if you are the person who is delegating authority.
<br /><br />
Indicate the person who will receive the authority:
<br />
<select name="delegate">
<option value="">(select)</option>
<option value="Johnson, Jay A">Johnson, Jay A</option>
<option value="Stiner, Bryan D">Stiner, Bryan D</option>
<option value="Oliver, Thomas E">Oliver, Thomas E</option>
<option value="Chacon, Jean P">Chacon, Jean P</option>
<option value="Williams, Greg S">Williams, Greg S</option>
</select>
<input name="delegateIsSubmitter" type="checkbox" />Check if you are the person receiving the authority.
<br /><br />
Enter the date on which the account will expire (default is 90-days, may not be greater than 90-days)
<br />
Month <input name="expMonth" type="text" size="2" maxlength="2" />
Day <input name="expDay" type="text" size="2" maxlength="2" />
Year <input name="expYear" type="text" size="2" maxlength="4" />
<input id="defaultExp" type="checkbox" onclick="setDefaultExpiration()" /> Use the default expiration of +90-days.
<br /><br />
Enter the title of authority being delegated:
<br />
<input name="authTitle" type="text" size="40" />
<br /><br />
Enter the lowest organizational level at which this authority applies:
<br />
<select name="orgLevel">
<option value="global">Global</option>
<option value="group">Group</option>
<option value="bu">Business Unit</option>
<option value="operation">Operation</option>
<option value="division">Division</option>
</select>
<input name="orgNum" type="text" size="10" />
<br /><br />
Enter any limitations to this delegation:
<br />
<textarea name="limitations" rows="3" cols="50"></textarea>
<br /><br />
<input type="submit" /><input type="reset" />
</form>
</div>
<?php include('footer.html'); ?>
</body>
</html>
setDefaultExpiration() is defined (lines 1-30) in the file JavaScript_function.js, which I now include:
Code: Select all
function setDefaultExpiration()
{
if(document.getElementById('defaultExp').checked == true) {
document.addRecord.expMonth.value = '';
document.addRecord.expDay.value = '';
document.addRecord.expYear.value = '';
document.addRecord.expMonth.disabled = true;
document.addRecord.expDay.disabled = true;
document.addRecord.expYear.disabled = true;
var d = new Date();
d.setDate(d.getDate() + 90);
document.addRecord.expMonth.value = d.getMonth()+1;
document.addRecord.expDay.value = d.getDate();
document.addRecord.expYear.value = d.getFullYear();
alert("The value of expMonth is " + document.addRecord.expMonth.value);
alert("The value of expDay is " + document.addRecord.expDay.value);
alert("The value of expYear is " + document.addRecord.expYear.value);
}
else {
document.addRecord.expMonth.value = '';
document.addRecord.expDay.value = '';
document.addRecord.expYear.value = '';
document.addRecord.expMonth.disabled = false;
document.addRecord.expDay.disabled = false;
document.addRecord.expYear.disabled = false;
}
}
function enableTextFields()
{
document.addRecord.expMonth.value = '';
document.addRecord.expDay.value = '';
document.addRecord.expYear.value = '';
document.addRecord.expMonth.disabled = false;
document.addRecord.expDay.disabled = false;
document.addRecord.expYear.disabled = false;
document.getElementById('defaultExp').checked = false;
}
And here is the current state of the second page, add_record_conf.php:
Code: Select all
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
<?php include('PHP_functions.php') ?>
</head>
<body>
<?php include('header.html'); ?>
<div id="content">
<?php
print_r($_POST);
validateExpDate();
?>
</div>
<?php include('footer.html'); ?>
</body>
</html>
Still at a loss to explain why these fields are not being "collected" by the POST array when they are set with JavaScript.