Skip to content

Commit

Permalink
Rename nested-forms to Master-Detail Forms
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Jul 6, 2023
1 parent 5dad371 commit 89bf840
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ to the user's browser.

- [Tiny splitwise clone](./examples/splitwise): a shared expense tracker app
- [Corporate Conundrum](./examples/corporate-conundrum/): a board game implemented in SQL
- [Master-Detail Form](./examples/master-detail-form/): shows how to implement a simple set of forms to insert data into database tables that have a one-to-many relationship.
- [SQLPage's own official website and documentation](./examples/official-site/): The SQL source code for the project's official site, https://sql.ophir.dev

## Configuration
Expand Down
33 changes: 33 additions & 0 deletions examples/master-detail-forms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Master-Detail Forms (Nested Forms)

This example shows how to handle inserting data into multiple tables
with a one-to-many relationship.

![db schema](./screenshots/db-schema.png)

A single master page features two forms based on two related tables or views.
Users insert data in the master form first to update information from the parent table.
Then, they can insert data in the detail forms to update information from the child tables.

This example application contains a main form to create users,
and a second form to create their addresses.

Once an user has been added, multiple addresses can be added to it.

See https://github.com/lovasoa/SQLpage/discussions/16 for more details.

The main idea is to create two separate forms.
In this example, we put both forms on the same page, in [`edit-user.sql`](./edit-user.sql).
The first one is an edition form for the already-existing user record,
and the second is a form to add an address to the user.

When you initially load the user creation form,
we do not display the address form.
Only when the user has been created,
you are redirected to the user edition form that contains the address form.


## Screenshots

![homepage](./screenshots/home-screenshot.png)
![user addition](./screenshots//user-add-screenshot.png)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
13 changes: 0 additions & 13 deletions examples/nested-forms/README.md

This file was deleted.

3 changes: 3 additions & 0 deletions examples/read-and-set-http-cookies/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM lovasoa/sqlpage

COPY *.sql sqlpage ./

0 comments on commit 89bf840

Please sign in to comment.