index.html, validated in script.js, and submitted to Google Sheets via google-apps-script.js. This page documents every field and explains how to add or remove fields.
Form fields
貴姓大名 — Guest name (required)
貴姓大名 — Guest name (required)
index.html
- ID:
name-input - Field name:
name - Type: text input
- Required: yes
validateForm() function in script.js explicitly includes 'name' in the requiredFields array.Relation — groom's or bride's side
Relation — groom's or bride's side
index.html
- ID:
relation-input - Field name:
relation - Type: dropdown
- Required: no
- Values:
friends-groom/friends-bride/other
Attendance — will you attend? (required)
Attendance — will you attend? (required)
index.html
- ID:
attendance-input - Field name:
attendance - Type: dropdown
- Required: yes
- Values:
yes/no
name. Used in the Google Apps Script to color-code the confirmation email (green for attending, red for declining).Guest count — number of attendees (required)
Guest count — number of attendees (required)
index.html
- ID:
guests-input - Field name:
guests - Type: dropdown
- Required: yes
- Values:
0–7and99(representing 8+ guests)
<option> elements.Dietary preference
Dietary preference
index.html
- ID:
dietary-input - Field name:
dietary - Type: dropdown
- Required: no
- Values:
""(non-vegetarian / 葷食),"1"(vegetarian / 素食),"2"(fasting)
"1" (素食) triggers the Vegetarian meals count conditional field via jQuery slideDown.Vegetarian meals count — conditional
Vegetarian meals count — conditional
This row is hidden by default (To extend the maximum count, add more
style="display: none;"). It appears when the guest selects 素食 in the dietary dropdown.index.html
- ID:
vegetarian-meals-input(row ID:vegetarian-meals-row) - Field name:
vegetarian-meals - Type: dropdown
- Required: conditionally (required when dietary =
"1") - Values:
1–3
script.js:script.js
<option> elements (e.g., <option value="4">4 份</option>).Children seats
Children seats
index.html
- ID:
children-seats-input - Field name:
children-seats - Type: dropdown
- Required: no
- Values:
yes/no
yes reveals the Children seat count conditional field.Children seat count — conditional
Children seat count — conditional
Hidden by default. Revealed when
children-seats = yes.index.html
- ID:
children-seats-count-input(row ID:children-seats-count-row) - Field name:
children-seats-count - Type: dropdown
- Required: conditionally (required when children-seats =
yes) - Values:
1–3
Paper invitation
Paper invitation
index.html
- ID:
invitation-input - Field name:
invitation - Type: dropdown
- Required: no
- Values:
yes/no
yes reveals the Mailing address field.Mailing address — conditional
Mailing address — conditional
Hidden by default. Revealed and made required when When the address row is hidden, the field’s
invitation = yes.index.html
- ID:
address-input(row ID:address-row) - Field name:
address - Type: textarea
- Required: conditionally (required when invitation =
yes)
script.js:script.js
required attribute is removed and the value is cleared so it does not block form submission.Message to the couple — optional
Message to the couple — optional
index.html
- ID:
message-input - Field name:
message - Type: textarea
- Required: no
Email — optional, for confirmation
Email — optional, for confirmation
index.html
- ID:
email-input - Field name:
email - Type: email input
- Required: no
isValidEmail() in script.js:script.js
Adding a new field
Add the HTML field in index.html
Copy an existing
<div class="row"> block and paste it at the desired position in the form. Update the id, name, label, and options:index.html
Add validation in script.js (if required)
If the field is always required, add its If the field is conditionally required, follow the pattern used for
name value to the requiredFields array inside validateForm():script.js
address, vegetarian-meals, and children-seats-count — push the name into requiredFields based on the triggering field’s value.Add the column header in google-apps-script.js
The Google Apps Script reads sheet column headers to map form values to columns. Add the new field’s After updating the script, redeploy the Google Apps Script web app and run
name to the headers array in createHeaders():google-apps-script.js
initializeSheet() to add the new column to the spreadsheet.Validation behavior
Client-side validation runs in two ways:- On blur:
validateField()is called for every input, select, and textarea when the user leaves the field. - On submit:
validateForm()checks all required fields before the form data is sent.
validateField() adds Bootstrap’s is-invalid / is-valid CSS classes and inserts an .invalid-feedback message below the field:
script.js