Help for "Edit fields" page

Edit fields page is needed for managing fields of the particular form.

It consists of two parts: list of fields with links for editing and checkboxes for deleting fields, and form for editing particular field with button "Save field".

In first part there is a link to add new field.

And alongside field's string in first part there is a link to edit this field.

When field is added or edited, all its properties appears in second part - in bottom form.

After changing field's properties it should be saved by clicking "Save field" button.

All fields in form are grouped in sections. And fields layout in each section is independent.

In one row can be located one or more fields.

Each row consists of amount of cells. Field title and field body can stretch to any number of cells, this values is set in field's properties "Title size" and "Field size".

Fields layout is defined by two field's properties: "Separate cells" and "Group with next".

First property cause drawing separator between field title and field body cells.

Second property cause next field to be located in the same row where current field is located.

In different rows may be different count of fields, because length of the cells is calculated automatically.

Some fields may have symbolic names. This names must be unique within the form.

This symbolic names will be used in next cases:

- if form field should exist in e-mail notification
- if form field is used in search filter
- to get value of field, known only by its symbolic name

Options of fields with multiple possible values (Select, Multiple select, Radio buttons) can be defined in textarea, each string this textarea is next option label of field. Value of each option can be set explicitly, after `,#` symbols combination in option label. Otherwise value will be set automatically, to some unique number.

Warning
once set, this values should not be changed to avoid errors in searching within a few form versions. Some options can be added, some can be deleted, but existing options must keep their values untouched.

Default values of such fields can be defined only after the field is added. There will be list of values in appropriate input elements, and all default values can be selected from this list.

There is a few constraints for field values.

Regular Expression constraint can be applied only to string fields.

Value-range constraints can be applied to string fields and to Select (for example, to prevent selecting first value, in this case value used in constraint is number of item, items are counted from 1)

Size-range constraints can be applied to string fields and text fields, they define length of field value (in symbols).

If field is required it cannot be empty (for string and text fields), or one or more values should be selected (for Radio button and Multiple select).

Any time of changing fields there is a way to preview current version of form, you just need to click "Preview" button.

Aften editing is done, click "Save changes" button to save all changes in new form version.

If it is needed to cancel editing, you should click "Cancel editing" button, so all changed will be abandoned.

For each field you can define specific CSS style. Styles are stored in plain-text format and may be edited by clicking link "Styles editor".

Styles apply to field cell `<TD>` and to field input (all input tags, for example `<select>`).

So you can define style like that:

    td.some_style {
    	...
    }

    select.some_style {
    	...
    }

    span.some_style {
    	...
    }

    input.some_style {
    	...
    }

and set style `some_style` for some field of "select" type (which contains "select" input).

In this case to cells where the field is located style `td.some_style` will be applied, to field title - style `span.some_style`, to field input element (i.e. "select") - style `select.some_style`, to string input element - style `input.some_style`, to text input element - style `textarea.some_style`, to radio button input element - style `label.some_style { ... };`

There is a mechanism to set default values for fields from user profile or user metadata.

If field default value contains strings like `{user:surname}`, this strings will be replaced with value fetched from database, "surname" is example of database field name. Instead of db field name - field alias can be used, like "postal" instead of "usercomments".

If field default value contains strings like `{user:[m]rank}`, this strings will be replaced with value fetched user metadata, "rank" is example of user metadata name.

There are other special constructions, being replaced with other values:

- `{now}` - date in format `long_date`
- `{now:day}` - day in format `dd`
- `{now:month}` - month in format `mm`
- `{now:year}` - year in format `YYYY`
- `{now:time}` - time in format `hh:mm`

Some fields may have calculated values. Values of this fields will be forcedly set, so it will be better for this fields to be disabled in order to prevent useless filling.

If field has default value like `{# }` with arithmetical expression inside, this field will equal this expression.

Using any functions (except mentioned below) in this expressions is prohibited. Using `;` is prohibited too. The only variables acceptable are the variables which has names equal to symbolic names of other fields with `$` after.

Any string fields, text fields, dropdowns, radio buttons, checkboxes can be used in arithmetical expression.

Checkboxes can equal to 0 or 1. Dropdowns and radio buttons can be assigned with their options values.

All values has "text" format by default.

To convert it to numeric - use functions `parseInt()` and `parseFloat()`.

To concatenate strings - use function `concat()`.

For example, if there are two form fields with symbolic names `a1` and `a2`, and third field has default value `{#parseFloat($a1)+parseFloat($a2)}`, this field will be set to sum of first two fields after the form is filled in.

Second example: `{#concat($a1,' ',$a2)}` will set value consisting of strings a1 and a2 separated by blank symbol.

Another example: `{# (parseInt($a1) < 10) ? ('A1 less than 10') : ((parseInt($a1) <= 20) ? ('A1 between 10 and 20') : ('A1 greater than 20')) }`.