LCS - Best Practices for Create Forms and Update Forms

This document outlines the best practices to utilize when creating forms and updating forms.

Create Form

The Create form is a page component with input fields and a submit button. The main purpose of the create form component is to gather the input of the user so that this can be submitted to the actions. Then it can go through the action’s configured flow and the user will receive either success or error messages.  

Using the create form component, you can create web pages that are connected to your data model. When adding the form component to the canvas, one can first follow the configure form to select what model and properties the form is going to be based on. Depending on what kind of properties are selected, input components will be created within the form to match them. 

When a user wants to create, update, or delete any record, the forms can be used to achieve these purposes. Below are best practices to adhere to when creating forms: 

Placeholders 

Use placeholders in all input fields to make sure that an input field is never empty. This also makes it more intuitive for a visitor to use the form. 

Loading state when submitting 

Toggle the submit button to a loading state when the visitor submits the form. This prevents visitors from submitting the form multiple times.  

Hide all alerts when submitting 

It can be very confusing if an old success/error message is still visible when the visitor is submitting the form.   

Show the response 

Show an alert or snack bar at a success or error response. The success message can be fixed, the error message can be dynamically from the server. 

Clear all input fields  

When the form responds in success, all inputs in the form can be cleared or set to default. This step is irrelevant when a redirect will be done after a successful response. 

Refetch the data table 

​When a table is present and a new record is created, the data table can be refetched so that the new record is immediately visible as a table row. 

NOTE: Deleting a form means automatically that the generated action will also be deleted. Keep this in mind.  

If you use custom styling on a button, before you delete your component, you can add it as a custom style so that you can reuse it. 

Steps to use the Create form: 

  1. Select the Create form component.

    Create form component

  2. Select model as shown in the screenshot below.

    select model box

    select model

    select project

    The 'project' model is selected in this example.

  3. Select properties that you want users to fill on the form by clicking on the plus sign ' icon.

    Save button


  4. Click the Save button

    success message

  5. Set permission on the create form by highlighting the whole form and clicking on the parent component icon shown below on the screenshot. 

    parent component icon

    screenshot of where to find how to move up to the next level from pagebuilder component

  6. Click on the pencil to edit action

    pencil icon

    Click Setting on the Action screen

    settings

    settings

  7. Properly name action and click Save. Please refer to the Naming conventions KB located here to correctly name components and actions. 

    name the action

  8. Click on Permissions tab

    permissions tab

    set permissions

  9. Set logged in user or admin to "Allowed"

    set perform action

  10. Click Save

    save permissions

    You are ready to begin using the form.

  11. Click the return to form arrow icon

    arrow icon

Steps to add extra fields to the create form

  1. Click on the 'Components' icon on the top left hand corner of the application

    components tab

  2. Either search for the specific component you need or scroll down to locate the component you want.

    locate specific component

    view of components for selection

  3. Drag the component you need to the location on the form where you desire. This example shows the 'price' component dragged into the form.

    drag the component to the desired location

  4. Click 'Select a property'

    select a property

  5. Click 'New properties'

    new properties button

  6. Select the property type and name the property

    select and name property

  7. Click 'Add property'

    add property button

  8. Press ‘Enter, and you should see the newly added property to select 

    newly added property displayed in list

  9. Click on the newly created property and click the Select button. This example shows 'Fees' as the newly added property.



  10. Click Save



    You should see your new component at the location you placed it on the form.

    success message

Steps to reorder the form components:

User can reorder the form component by clicking on the specific component and dragging it to the location on the create form that the user desires. 

  1. Click on the component that you want to reorder.

    click on component to drag

  2. Drag the component to the desired order on the form

    click on component to drag

Best Practices for Update Forms

The update form component is an important component that is used to manage your data. The update form allows users to update data from existing object. The following are some best practices to keep in mind when using the update form: 

Changing model in update form

Remember to erase all selected properties after you have updated the model in the update form and re-select the correct properties based on the new model that you select.

Placeholder 

Use placeholder in all input fields to ensure that an input field is not empty.  

Set permission on update form  

Make sure that you have the right permission set on the update form to allow users and admin to access and use the form.  

Hide alerts when submitting update form 

Avoid confusing users and make sure that there is no old success/error message visible when users submits the update form.  

Show update form response 

Always show a success or error response when the update form is submitted to tell the users when things are working well or not.  

Clear all input fields  

When the update form responds in success, all inputs in the form can be cleared or set to default. This step is irrelevant when a redirect will be done after a successful response.  

Refetch the data table 

​When a table is present and a new record is created, the data table can be refetched so that the new record is immediately visible as a table row.  

NOTE: Deleting a form means automatically that the generated action will also be deleted. Keep this in mind.  

If you use custom styling on a button, before you delete your component, you can add it as a custom style so that you can reuse it. 

Update form steps: 

Below are the steps to configure update form: 

  1. Select ‘Update Form’ under the form component. 

    update form selection

  2. Select where the data is coming from - 'Another page' or 'this page'

    select data source

  3. Click on ‘Select model’ and select a model

    select model list

    An example Select 'Project' and click Select.

    project selection

  4. Select properties that you want users to see and click Save 

    save button

    NOTE: If you are changing model, user must erase all previously chosen properties and re-add new properties from the new model selected. 

    erase previously chosen properties

  5. Click the ‘Select parent component’ icon to select the whole form to edit permissions and properly name the form action button. Please refer to the Naming conventions KB located here to correctly name components and actions. 

    select parent component button

    The form is highlighted

    highlighted form

    Note: The update form has a built-in action that'll automatically be configured for you so that you can easily update the object from the form. 

Below is the action and its update record step:

  1. Click the action pencil icon.

    pencil icon

  2. Click the Settings on the top left hand corner of the application

    settings button

  3. Rename the action and click Save

    rename action window

    save action name

  4. Click the settings tab and set users and admin to 'Allowed'

    set permissions

  5. Click Save

The form is now ready to be used. Click here to read more about actions.

For more information about development best practices see Best Practices for the Software Development Lifecycle (SDLC) in Betty Blocks 



Keywords:
best practices, create form, update form, create, forms, update, for create, practices, and update, forms and, best, practice 
Doc ID:
135052
Owned by:
Oby O. in Low Code Solutions
Created:
2024-01-26
Updated:
2024-02-01
Sites:
DoIT Enterprise Business Systems - Low Code Solutions