One of the basic operations of a data driven application is the ability to create records of information to be stored in the database. This functionality can be implemented using a Form widget.
To quickly design screens to create, show and edit a single record, see the topic About Scaffolding a CRUD.
As an example assume you have an application to manage contacts and that you already have a Contact entity created in that application.
To create a Contact record in the database:
- Create a web screen, e.g. CreateContact;
- In that web screen, create a local variable of data type Contact;
The data type must match the record you want to store in the database, in this case the entity is the Contact entity.
- Add a Form widget to the web screen;
- Bind the local variable to the form’s 'Source Record' property;
This defines the data type of the Record runtime property. See Form Widget Runtime Properties.
- Drag and drop the Contact entity into the Form;
This creates the layout to gather the data from the end-user as described in About Record Widgets. Each input is bound to the corresponding attribute in the Record runtime property.
- Add a button to the form to send the information back to the server.
- On the 'Save' Screen Action, use the CreateContact entity action to store the information that is collected.
Show and Edit a Single Record | About the Form Widget | Form Widget Runtime Properties | About Scaffolding