Field types

These are the field types you can choose when creating a new field. Plug-ins may supply additional field types that are not documented here.

Some of these field types have attributes, which you can use to further limit the data the field can hold. If you do not want to limit the data, you can leave the attributes blank and they will not be used.

  • String: a piece of text of variable length, this could be as short as a name or few characters or as long as a document. A string has no formatting. Attributes: options, which you can use to limit the contents of the field to a few choices which are specified by a list of those options, separated by comma. For instance, if you are storing traffic light states, you can enter "Red, Yellow, Green" as the options which mean that on entry the user would be given a drop-down box with those three options instead of a free text entry box.

  • Integer: a whole number, positive or negative. Attributes: max and min, upper and lower bounds (inclusive) for the value. For a value which can only be zero or positive, set min to 0 and leave max blank

  • Bool: a Boolean value, that is a value that can be true or false. (Note that if the field is not required, it can also be missing.) No attributes.

  • Date: a point in time including both day and time of day. No attributes

  • Float: a floating-point number, i.e. with decimal points and a scientific exponent which can accommodate very small numbers or very large numbers, both positive and negative. Attributes: max and min, upper and lower bounds (inclusive) for the value. units, a text string for the units of measure. decimal_places, the number of decimal places to use in input and output.

  • Color: a colour value in RGB colour space. Stored internally as a hexadecimal number, e.g. "#00ff88".

  • Key to {table}: a reference to a different table, for instance indicating that this row belongs to a row in a different table. Attributes: the summary field, the field in the referred table to use for input and output.

  • Key to users: a reference to a user with a Saltcorn account in the current installation. No attributes

  • File: a reference to a file. Attributes: the minimal role which would be required to download files uploaded using forms for this table.