No application would be complete without the ability to show and edit a single record. You can implement this functionality using a Form widget.

To quickly design screens to create, show and edit a single record.

As an example assume you have an application to manage contacts and that you already have a Contact entity created in that application.

To show and edit a Contact record:

  1. Create a web screen, e.g. ContactDetail
  2. Add an input parameter of data type Contact Identifier, e.g. ContactId
  3. Add an aggregate to the preparation to fetch this contact from the database
  4. Add a Form widget to the screen and bind it to the output of the aggregate in the preparation
  5. Drag and drop the Contact entity into the Form.
  6. Add a 'Save' button to the form and use the UpdateContact entity action to store the changes performed by the end-user in the database.

Creating a Single Record on the same page

With a few changes you can transform this page to allow creating contacts. The steps are as follows:

  1. Set the 'ContactId' screen input parameter as non mandatory.
  2. Add a If widget to the screen to conditionally show the page title either as the contact name or as 'New Contact', depending on the 'ContactId' parameter having a value other than NullIdentifier or not.
  3. In the 'Save' screen action replace the UpdateContact entity action with the CreateOrUpdateContact entity action.

See Also

About the Form Widget | Form Widget Runtime Properties | About Scaffolding