Skip to main content

Create a model by designing a Form

Introduction

You create a table model, the add and update form and a default report when you save the form. Therefore you need to have prepared a number of things before before you start creating the model. These are:

  • The model or table name - all the major models and their associated forms and reports were created when the system was first installed. You can edit any of the existing forms to add new fields but generally this will not be necessary. You will generally be considering this activity because you are adding something completely new.
  • The field names - it makes sense to create another spreadsheet along the lines of that we provide at /docs/Cliqon V9 Data Dictionary. By default, the Redbean ORM database facility automatically creats every field as a variable alphanumeric field (Varchar(255)) and changes and expands this when needed.
  • Select and list options - if the form is going to include selectsor radio choices, these should be configured as options. A static list can be entered or a list accessed dynamically.

Creating the model form

Open the Form Designer. It consists of three panes. On the left are the components that can be used. On the right is a column where the options for that element will displayed and can be augmented and edited. Some of the additions that we will describe in this section are mandatory, please pay particular significance to these instructions. In the middle is the drawing board to which components will be dragged.

Forms can have multiple rows and columns but all of these must sit within a Group. By default, any buttons are displayed outside and below the Group in a separate box. 

Start by entering the name of the model / form as the ID of the form. This should be entered as "form-modelname", e.g. form-dbcontact. This is mandatory. Version tag is optional and is numeric.

Drag a Container->Group to the drawing surface. In the options column, enter an explanatory name for the group, for example: "Form for dbmodels". In Custom Properties, create a key called table and enter a value for that key, which must be the name of the database table. This is mandatory.

We choose to have a header row for our forms and sub-heading or description below. So drag two text-views to the drawing surface and inside the Group. Then edit