Calculate order price by date selection value
Posted
by albatross
on Stack Overflow
See other posts from Stack Overflow
or by albatross
Published on 2010-03-01T21:35:13Z
Indexed on
2010/04/23
2:13 UTC
Read the original article
Hit count: 362
Alright, I know there's a simple way to do this, but it's been years since I've done much javascript
My client has an online order form for event registration (developed by previous web dev.). Currently the order total is just a hidden field:
<INPUT value=78.00 type=hidden name=amount />
But I need the total to calculate based on what date they choose:
<SELECT style="BACKGROUND-COLOR: #ffff99" name=altDate1>
<OPTION value=04/09> Friday, April 9 </OPTION>
<OPTION value=04/14> Wednesday, April 14 </OPTION>
<OPTION value=04/16> Friday, April 16 </OPTION>
<OPTION value=04/19> Monday, April 19 </OPTION>
<OPTION value=04/29> Thursday, April 29 </OPTION>
</SELECT>
This is the javascript that process the form:
<SCRIPT language=Javascript>
function PaymentButtonClick() {
document.addform.Product_Name.value = document.Information.StudentLastName.value + ","+
document.Information.StudentFirstName.value+","+
document.Information.StudentID.value+","+
document.Information.altDate1.name+","+","+
document.Information.Guests.value+ "," +
document.Information.StudentType.value;
document.addform.Product_Code.value = document.Information.StudentID.value;
if ((document.Information.UCheck.checked==true) &&
(document.Information.altDate1.value != "") &&
(document.Information.altDate1.value != "x")) {
if (document.Information.StudentLastName.value != "" ||
document.Information.StudentFirstName.value != "" ||
document.Information.StudentID.value != "" ) {
document.addform.submit();
}
else {
alert("Please enter missing information");
}
}
}
</SCRIPT>
© Stack Overflow or respective owner