Forms
Data entry forms enable you to display, create, update, and delete database records. Visual DB lets you lay out forms in a natural format: input fields can be sized to fit their content, and related fields (like City, State, and ZIP) can be arranged in the same row.
Start by Defining a Query
Creating a form begins with defining a query. The form displays all records returned by this query, one record at a time. Each query consists of a main table and optional lookup tables. While you can update fields from the main table, fields from lookup tables are display-only and cannot be modified.
Use query parameters to let the user precisely specify the record (or records) to fetch from the database.
Changing Input Type
Visual DB supports multiple input types, which varies depending on the data type of the field. Here are the available input types:
Text: Single-line Textbox, Multiline Textbox, Formatted Textbox, Radio buttons
Number: Textbox
Date: Date Picker
Boolean: Checkbox, Radio buttons
Additionally, if Available Values are defined for a field, a dropdown box will appear, allowing you to select from the available values. In the Input Type menu, you can also choose to use radio buttons as an input method.
Limit User Input to Allowed Values
You can define a list of allowed values for users to select from. The Available Values feature helps you create this list. To access Available Values, enter Design Mode, click on a field, and select Available Values from the design panel. You can create this list of allowed values in several ways:
Offer Existing Values: Displays all values previously entered into the column of the respective database table.
Get From a Database Table: Allows you to provide a new table containing all allowed values.
Get Using a Query: Enables you to create or select a query that returns the allowed values.
Specify Manually: Lets you manually enter each allowed value one by one.
Once you have implemented the Available Values, a dropdown menu will appear for that field. You can also change the input type to radio buttons if that better suits your needs.
Note
You can allow users to add new values that are not displayed in the dropdown. Use the checkbox located below the Available Values option in Design Mode.
Displaying Labels Instead of ID Values
In many cases, you may need to present values such as IDs in a more readable format. The Available Values feature includes a label option that allows you to display IDs as something more understandable, like an employee name, while still storing the ID number (not the text) in the database.
To display labels, enter Design Mode, click on a field, and select the Available Values option from the right menu. These labels can be sourced from various places, as discussed in the section above. Note that you must specify the allowed values for that field and assign appropriate labels to them, which may come from a table, query, or other sources.
Preventing NULL Values with Default Values
To prevent null fields in a form, you can provide default values. To access default values, enter Design Mode, click on a field, and select Default Values from the right menu. If a user does not provide data for a given field, the default value will automatically be entered into that field.
Validating User Input
If you need to prevent users from entering certain data into a specific field, then Validation is the solution. Validation allows you to restrict the values that can be entered directly into a field, ensuring data integrity for that field. If you want to enforce a specific range of acceptable values, Validation is the tool to implement such restrictions.
To add Validation, enter Design Mode and click on the field you want to validate. In the bottom right corner, you will find the Validation settings. The available Validation parameters will vary depending on the data type of the field. Below are the types of Validation available based on the data type:
All: Required field
Number: Minimum/Maximum Value
Text: Minimum/Maximum Length, Allowed/Disallowed Characters, Regex, Social Security Number, US Phone Number, Email Address, US Zip Code, Credit Card Number, URL
Date: No Earlier/Later Than, Today or Later, Tomorrow or Later, Today or Earlier, Yesterday or Earlier, Date of Birth
Validating User Input while Correlating Fields
Submit rules are a way to prevent certain forms from being submitted based on the data entered into multiple fields. Submit rules can enforce more complex logic than single-field Validation alone. For example, you can require that one of two fields be populated for the form submission to be accepted.
To create a submit rule, enter Design Mode and select Submit Rules from the right menu.
Conditonally Disabling or Hiding Fields
To prevent users from entering data into fields that are not applicable to them, you can enable or disable certain fields using Form Rules.
To access Form Rules, enter Design Mode and select Form Rules from the right menu. You will need to specify conditions under which a field may be enabled or disabled. Typically, these conditions are based on the state of other fields. For example, if a user selects “Yes” in one field, you might enable an explanation field that you want the user to fill out based on their previous answer.