Skip to content

Commit 154f5d0

Browse files
committed
new form component documentation
1 parent 7b51990 commit 154f5d0

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,36 @@ INSERT INTO example(component, description, properties) VALUES
207207
;
208208

209209
INSERT INTO component(name, icon, description) VALUES
210-
('form', 'cursor-text', 'A series of input fields that can be filled in by the user. ' ||
211-
'The form contents can be posted and handled by another sql file in your site. ' ||
212-
'The value entered by the user in a field named x will be accessible to the target SQL page as a variable named $x.
213-
For instance, you can create a SQL page named "create_user.sql" that would contain "INSERT INTO users(name) VALUES($name)"
214-
and a form with its action property set to "create_user.sql" that would contain a field named "name".');
210+
('form', 'cursor-text', '
211+
# Building forms in SQL
212+
213+
So, you have an SQL database, and would like to let users input data into it?
214+
The `form` component is what you are looking for.
215+
216+
## Collecting data from users to your database
217+
218+
The form component will display a series of input fields of various types, that can be filled in by the user.
219+
When the user submits the form, the data is posted to an SQL file specified in the `action` property.
220+
221+
## Handle Data with SQL
222+
223+
User-entered data is posted to an SQL file, that will handle the data,
224+
and will be able to insert it into the database, search for it, format it, etc.
225+
226+
For example, a value in a field named "x"
227+
can be referenced as `:x` in the SQL query of the target page.
228+
229+
## Examples
230+
231+
- **Data Entry Automation**: Forms for tasks like inventory management.
232+
- **Custom Report Builder**: Generate reports based on user-specified criteria.
233+
- **Database Management**: Update records or query data.
234+
- **Admin Panel**: Manage user roles and permissions.
235+
- **Data Analytics with SQL**: Collect data for analytics.
236+
- **SQL Query Parametrization**: Build and execute complex SQL queries that depend on user input.
237+
- **SQL CRUD Operations**: Perform Create, Read, Update, and Delete operations.
238+
- **Web SQL**: Integrate forms into web applications.
239+
');
215240
INSERT INTO parameter(component, name, description_md, type, top_level, optional) SELECT 'form', * FROM (VALUES
216241
-- top level
217242
('enctype', '

0 commit comments

Comments
 (0)