[Go to site: main page, start]

Interface NumberFieldOptions

interface NumberFieldOptions {
    choices?: object | Function | number[];
    gmOnly?: boolean;
    hint?: string;
    initial?: any;
    integer?: boolean;
    label?: string;
    max?: number;
    min?: number;
    nullable?: boolean;
    persisted?: boolean;
    placeholder?: string;
    positive?: boolean;
    readonly?: boolean;
    required?: boolean;
    step?: number;
    validate?: DataFieldValidator;
    validationError?: string;
}
Index

Properties

choices?: object | Function | number[]

An array of values or an object of values/labels which represent allowed choices for the field. A function may be provided which dynamically returns the array of choices.

gmOnly?: boolean

Can this field only be modified by a gamemaster or assistant gamemaster?

hint?: string

Localizable help text displayed on forms which render this field.

initial?: any

The initial value of a field, or a function which assigns that initial value.

integer?: boolean

Must the number be an integer?

label?: string

A localizable label displayed on forms which render this field.

max?: number

A maximum allowed value

min?: number

A minimum allowed value

nullable?: boolean

Can this field have null values?

persisted?: boolean

Is a value of this field written to source data? A Non-persisted value is initialized (with its initial value), and ActiveEffects can use the field for change application.

placeholder?: string

Localizable text displayed in placeholders of form inputs which render this field.

positive?: boolean

Must the number be positive?

readonly?: boolean

Should the initialized (prepared) property of the DataModel instance for this field be read-only, i.e. nonwritable and nonconfigurable? The source value of a read-only field can still be changed by updateSource, but a source change won't necessarily be reflected on the prepared value. Usually the prepared value of a read-only field is effectively immutable, but not in all cases: for example, EmbeddedCollectionField. The _id field is a special behavior: the prepared property becomes nonconfigurable only after the source value becomes a nonnull value for the first time.

required?: boolean

Is this field required to be populated?

step?: number

A permitted step size

A custom data field validation function.

validationError?: string

A custom validation error string. When displayed will be prepended with the document name, field name, and candidate value. This error string is only used when the return type of the validate function is a boolean. If an Error is thrown in the validate function, the string message of that Error is used.