CharField

Source
import { CharField } from "@prestojs/viewmodel";

Examples

Default widget in a Form

Default formatter for CharField

API

Constructor

new CharField(?values)
Source

Arguments:

ArgumentTypeDescription
values
An object with the properties below
values.asyncChoicesAsyncChoicesInterface
values.blankboolean
values.blankAsNullboolean
values.choices|[SingleValueT, string][]
values.defaultValuenull|ValueT|
values.formatterPropsRecord
values.helpTextstring
values.labelstring
values.maxLengthnumber
values.readOnlyboolean
values.widgetPropsRecord
values.writeOnlyboolean

Methods

clone()
Source
Returns:Field
contributeToClass(viewModel)
Source

Arguments:

ArgumentTypeDescription
*viewModelViewModelConstructor
Returns:void
format(value)
Source

Arguments:

ArgumentTypeDescription
*valuestring
Returns:any
getFormatterProps()
Source
Returns:{[fieldName: string]: any }
getWidgetProps()
Source
Returns:
An object with these properties:
PropertyTypeDescription
maxLengthnumber
isEqual(?value1,?value2)
Source

Arguments:

ArgumentTypeDescription
value1string
value2string
Returns:boolean
normalize(value)
Source

Arguments:

ArgumentTypeDescription
*valuestring
Returns:null|string
parse(value)
Source

Arguments:

ArgumentTypeDescription
*valuenull|string
Returns:null|string
toJS(value)
Source

Arguments:

ArgumentTypeDescription
*valuestring
Returns:null|string|number|Record
toString()
Source
Returns:string

Properties

blank

Source
boolean

blankAsNull

Source
boolean

boundRecord

Source
undefined|ViewModelInterface

choices

Source

defaultValue

Source
undefined|null|ValueT|Promise

formatterProps

Source
Record

helpText

Source
string

isBound

Source
boolean

label

Source
string

maxLength

Source
number

name

Source
string

readOnly

Source
boolean

value

Source
undefined|ValueT

widgetProps

Source
Record

writeOnly

Source
boolean

Static Properties

fieldClassName

Source
string