Getting started
...
Create an app from scratch
Create Data - Form & List
Create a new customer form
5min
In this section, you learn how to create a form with a two-column layout and three fields, and how to configure an action button on the form that will create the record in the Dynamic data provider.
- You can delete this jig's header, onFocus, and datasource lines.
- The controls displayed on the are defined under the children node on a default . All the input controls are placed on a form component. A control is uniquely identified by its instanceId. They are added as children of a field-row component to display two controls next to each other. A text-field component is used to capture text information on a form, and the email field component is used to capture email addresses. Under the children: node, add these fields as shown below to capture the customer's first and last name and email address:
- The top-level action on a default places a button at the bottom of the screen. A submit-form action saves the data from the text boxes to the SQLite database. The submit form action automatically matches the instanceIds of the controls on the and creates a record in the local SQLite table with each instanceIds as a property for the JSON object in the Data column. At the same root YAML level as children: use ctrl+space to add the actions node. Use the code below to create the action.submit-form type, define the data provider to be the Dymamic data provider, and use the method: create to save the record.
2. After the record is created you want to navigate back to the , add the goBack: previous action to the bottom of the actions node. 3. With Dynamic Data you need to add the reference to the table in the database. In the databases node click on the default.jigx file. Type customers: null under tables: as shown below.
4. Your new-customer.jigx file should resemble the code below.
Updated 31 Oct 2023
Did this page help you?