# Advanced input forms

## <span class="mw-headline" id="bkmrk-usage-1">Usage</span>

In TS it is possible to configure very advanced and dynamic input form behavior. The goal is to minimize the effort required to enter data, and at the same time maximize data quality.

In case you need step-by-step questionnaires or wizards, we recommend looking at [Questionaires](https://wiki.tsnocode.com/index.php?title=Features/Questionaires "Features/Questionaires")

TS has implemented more than 160 fields of various types, as documented in the [Field reference](https://docs.tsnocode.com/books/field-type-reference "Field type reference")

## <span class="mw-headline" id="bkmrk-validation-rules-1">Validation rules</span>

Validation of field values can follow one of the following

- The value is required
- Can be validated by a Regex expression
- Have a value within a minimum and/or maximum

Value ranges will differ according to data type

- Numbers: The value
- Text: Length of text
- Date: Allowed years
- Files: Number of files

Note that dependencies are resolved before validation, so in case a field is not relevant the validation rule will be ignored.

### <span class="mw-headline" id="bkmrk-instructions-1">Instructions</span>

1. Click on field 
    - Check of Validation
    - Remove check in Allow empty values

## <span class="mw-headline" id="bkmrk-field-dependencies-1">Field dependencies</span>

Fields can be dependent on values in other fields. Specific values, value ranges or list of values.

```
 Show SUBCATEGORY if CATEGORY contains either Foo, Bar or Foobar
```

```
 Show field NOTES if PRICE is higher than 1000
```

In case the dependency is even more complex, an expression written in JS can be defined and linked to the field

## <span class="mw-headline" id="bkmrk-workflow-dependencie-1">Workflow dependencies</span>

Fields can be dependent on the records location in the workflow governing that entity. Each status is assigned a status level.

Fields can then refer to the workflow model with restrictions

- Status level FROM
- Status level TO

If the status restrictions are not satisfied the field will be removed and validation requirements will be ignored.

Note that 0 signifies that the status level restriction is disabled.

### <span class="mw-headline" id="bkmrk-instructions-3">Instructions</span>

Learn to setup [Features/Status level dependencies](https://docs.tsnocode.com/books/features/page/status-level-dependencies "Features/Status level dependencies")

## <span class="mw-headline" id="bkmrk-lookup-fields-1">Lookup fields</span>

TS contains a lot of specialized lookup fields that have defined datasources ready

- Danish postal codes
- Danish addresses (DAWA)
- Countries and currencies
- NACE codes (tree searchable)
- UNSPSC codes
- SKS framework (7 subtypes)

The DAWA lookup can also work together with a Google Map. Entering an address will update the map with the location, and clicking on the map will find the address.

## <span class="mw-headline" id="bkmrk-duplicate-prevention-1">Duplicate prevention</span>

To ensure that the same data are not duplicated by mistake, it is possible to ensure that new records are unique based on values in one or more fields.

Learn to set up [Features/Duplicate prevention](https://docs.tsnocode.com/books/features/page/duplicate-prevention "Features/Duplicate prevention")