Copy link to clipboard
Copied
I am working on a form for a bar contract for use at a local 503-C Social Hall which is rented out for fundraising to support the group. The form contains five radio buttons to select the type of bar service package desired, and I am trying to have the selected package display on the billing page of the contract. The following Javascript code generates this error: "SyntaxError: Missing ; before statement 17: at line 18". Any help deeply appreciated.
// This JavaScript Displays the chosen Bar Package from
// Page 1 of the Bar Contract by first retrieving the results
// of the Radio Button Selection on that page
var Package = this.getField("Bar Service").value;
// Then determine the Package price per person
if (Package == "None") {
event.valu = "No Beverage Services Requested, No Charge."
} else if (Package == "Non-alcohol") {
event.valu = "Non-Alcoholic Package Requested, $2.00 per person, per hour."
} else if (Package == "Beer") {
event.valu = "Beer, Wine & Soda Package Requested, $4.00 per person, per hour."
} else if (Package == "Open") {
event.valu = "Open Bar Package Requested, $7.00 per person, per hour."
} else (Package == "Cash") {
event.valu = "Cash Bar Package Requested, $15.00 per Bartender, per hour, per 60 guests."
}
Thank you for the assistance, I figured it out! The following code works:
// This JavaScript Displays the chosen Bar Package from
// Page 1 of the Bar Contract by first retrieving the results
// of the Radio Button Selection on that page
var Package = this.getField("Bar Service").value;
// Then determine the Package price per person
if (Package == "None") {
event.value = "No Beverage Services Requested, No Charge."
} else if (Package == "Non-alcohol") {
event.value = "Non-Alcoholic Package Reque
Copy link to clipboard
Copied
1. It's event.value, not event.valu...
2. In the last clause you forget to add if before the else...
Copy link to clipboard
Copied
Thank you for the rapid response. I had already noticed and corrected the event.valu in the last line. I tried your suggestion, and changed the last clause to read:
} if else (Package == "Cash") {
event.value = "Cash Bar Package Requested, $15.00 per Bartender, per hour, per 60 guests."
}
and received the following error: "SyntaxError: missing ( before condition 17: at line 18"
Copy link to clipboard
Copied
Thank you for the assistance, I figured it out! The following code works:
// This JavaScript Displays the chosen Bar Package from
// Page 1 of the Bar Contract by first retrieving the results
// of the Radio Button Selection on that page
var Package = this.getField("Bar Service").value;
// Then determine the Package price per person
if (Package == "None") {
event.value = "No Beverage Services Requested, No Charge."
} else if (Package == "Non-alcohol") {
event.value = "Non-Alcoholic Package Requested, $2.00 per person, per hour."
} else if (Package == "Beer") {
event.value = "Beer, Wine & Soda Package Requested, $4.00 per person, per hour."
} else if (Package == "Open") {
event.value = "Open Bar Package Requested, $7.00 per person, per hour."
} else if (Package == "Cash") {
event.value = "Cash Bar Package Requested, $15.00 per Bartender, per hour, per 60 guests."
}
Copy link to clipboard
Copied
Sorry, I meant to write that you forget to add if ​after​ the else...