Forms
Syntax
Section titled “Syntax”| Form | Syntax | Usage |
|---|---|---|
| Form | fence form title="Contact" method="post" action="/send" submit="Send" | Form start. |
| Input | field name="email" type="email" label="Email" required | Field. |
| Textarea | textarea name="message" rows="5" | Long text. |
| Select | dropdown / select with options | Choice list. |
| Checkbox | check / checkbox | Checkbox. |
| Radio | `radio name=“level” options=“A | B”` |
| Hidden | hidden name="source" value="docs" | Hidden value. |
| Validation | regex, min, max, required, help, placeholder, value | Constraints. |
The historical field reference is integrated above: field, textarea, dropdown/select, check/checkbox, radio, hidden, submit, help, regex, required, placeholder, value, min, max.
POST form
Section titled “POST form”~~~form title="Contact" method="post" action="test.php" submit="Send"
field name="name" label="Name" required placeholder="Your name"
field name="email" type="email" label="Email" required regex="^[^@\s]+@[^@\s]+\.[^@\s]+$" help="Valid email address"
textarea name="message" label="Message" required rows="5" help="Your request in a few lines"
dropdown name="topic" label="Topic" required options="Support|Sales|Other" placeholder="Choose a topic"
check name="privacy" label="I accept the processing of my request" required help="Required before sending"
~~~
GET search
Section titled “GET search”~~~form title="Advanced search" method="get" url="/search" submit="Search"
field name="q" label="Keyword" required placeholder="ex: markdown" help="Search sent in the URL"
dropdown name="type" label="Type" options="All:all|Guides:docs|Astro pages:astro" value="all"
field name="limit" type="number" label="Results" min="1" max="50" value="10" help="Between 1 and 50"
check name="exact" label="Exact phrase"
~~~
Choices and validation
Section titled “Choices and validation”~~~form title="Workshop registration" type="post" file="workshop.php" submit="Validate"
field name="first_name" label="First name" required regex="^[A-Za-z -]{2,}$" help="At least two characters"
field name="phone" type="tel" label="Phone" regex="^(\\+33|0)[1-9][0-9]{8}$" help="Expected French format"
radio name="level" label="Level" required options="Beginner|Intermediate|Advanced"
dropdown name="slot" label="Slot" required options="Morning:am|Afternoon:pm|Evening:evening" placeholder="Choose"
textarea name="notes" label="Notes" rows="4" placeholder="Constraints, allergies, useful information..."
hidden name="source" value="documentation"
~~~