Basic Usage
Handling Form Data
When a form is submitted, values are available as SQL parameters in the target page. A field named “username” becomes:username in your SQL query.
Top-Level Properties
Name to display at the top of the form in larger font
Link to the target SQL file that handles form submission. Defaults to the current page with the form’s id as hash.
Set to ‘GET’ to pass form contents as URL parameters (e.g.,
target.sql?x=v). Use POST for sensitive data.Text for the submit button. Set to empty string to remove the button completely.
Color of the submit button (e.g., primary, green, red, blue)
Outline color for the submit button
Icon to display on the left side of the submit button
Shape of the submit button (e.g., pill, square)
Size of the submit button (e.g., sm, lg)
Text for the reset button. Omit to hide the reset button.
Color of the reset button
Icon for the reset button
Unique identifier for the form. Use with the button component to submit from outside the form.
Automatically submit when any field changes. Removes the submit button.
Encoding type when method is POST. Automatically set to
multipart/form-data for file uploads.Field Properties
Field identifier used to retrieve the value in the target page (e.g.,
:fieldname)Input type: text, number, email, password, tel, url, date, time, datetime-local, month, week, color, range, file, textarea, select, radio, checkbox, switch, hidden, header, submit
Friendly name displayed to the user. Defaults to the field name.
Placeholder text shown when the field is empty
Default value pre-filled in the field
Helper text displayed near the input field
Prevent form submission if this field is empty
Field width from 1-12. Use smaller values to place fields side-by-side.
Automatically focus this field when the page loads
Makes the field non-editable and not submitted with the form
Prevents editing but the value is still submitted
CSS class to apply to the form element
HTML identifier for JavaScript manipulation or styling
Text Input Properties
Minimum text length allowed
Maximum text length allowed
Regular expression the value must match (e.g.,
[0-9]{3} for 3 digits)Whether the browser should suggest previously entered values
Text to display on the left side of the input
Icon to display on the left side of the input
Text to display on the right side (e.g., currency symbol, units)
Number Input Properties
Minimum value for number inputs
Maximum value for number inputs
Increment value for number inputs. Set to 1 for integers only.
Textarea Properties
Number of visible text rows for textarea
Select Properties
JSON array of objects with
label, value, and optional selected propertiesAdds an empty option with the given label before other options
Allow selecting multiple options. Use square brackets in name:
my_field[]Display with a dropdown that allows searching for options
Alias for searchable
Allow users to enter new values not in the options list
URL to dynamically load options as the user types. Returns JSON with
value and label.Checkbox and Radio Properties
Whether the checkbox or radio button appears checked
File Upload Properties
Allowed file types (e.g.,
image/png, image/jpeg, .pdf)sqlpage.uploaded_file_path.
Examples
Basic Registration Form
Multi-Column Layout
Select Dropdown from Database
Radio Buttons
Toggle Switches
File Upload
handle_upload.sql:
Auto-Submit on Change
Form with External Submit Buttons
Input with Prefix and Suffix
Form with Headers
Hidden Fields
All Input Types
Text-Based Inputs
- text: Single-line text input (default)
- email: Email address with validation
- password: Masked password input
- tel: Telephone number
- url: Web address with validation
- search: Search input
- textarea: Multi-line text input
Number Inputs
- number: Numeric input with increment controls
- range: Slider for selecting a value
Date and Time
- date: Date picker
- time: Time picker
- datetime-local: Date and time picker
- month: Month and year picker
- week: Week picker
Selection
- select: Dropdown menu
- radio: Radio button (one choice from a group)
- checkbox: Checkbox (multiple choices)
- switch: Toggle switch (SQLPage custom type)
File
- file: File upload input
Other
- color: Color picker
- hidden: Hidden field (not visible to users)
- header: Section header (SQLPage custom type)
- submit: Submit button within the form
Security Notes
- Always use parameterized queries (
:parameter) to prevent SQL injection - Use POST method for sensitive data
- Validate and sanitize user input in your SQL queries
- Don’t commit files with secrets like
.envorcredentials.json
Related Components
- button - Submit forms from outside with the
formproperty - authentication - Protect forms with login