data-frictionless-booking to the <form>, give each box the right name, and load the script. Leave the times box empty: the script fills it with your free times, grouped by day, and keeps your first option as the placeholder.
Box names
Answers are checked against your booking form:
- Dropdown: the value must be one of your choices. Capital letters don’t matter.
- Yes / No:
YesorNo, from a dropdown, radio buttons or a checkbox withvalue="Yes". - Date:
YYYY-MM-DD, which is what<input type="date">sends. - Boxes with other names are ignored.
When they press the button
- Your
requiredattributes are checked first, by the browser. Then the script sends the form to Frictionless instead of submitting it. - Booked: anything inside the form marked
data-frictionless-successis shown, withdata-frictionless-whenfilled in (for example “Thu 8 Oct at 9:00am”), and everything else in the form is hidden. Without one, the form is replaced by a short “You’re booked” line. - A problem with one box, such as a department left empty, shows on that box as the browser’s own message. Anything else shows in an element marked
data-frictionless-error, or in a line added under the form. - Someone took the time a moment ago: the times are refreshed and they’re asked to pick another.
React
Your own form works in React too, controlled or not, as long as each box has aname. Render the times box with no options, <select name="start" required />, so React leaves the times the script adds alone.
