Field value formats
Form field values can be represented by an object, a string, or a number. This applies both to reading (obtaining values via FormState) and writing (returning a new field value).
| Type | Reading | Writing |
|---|---|---|
Text, Email, Telephone | {
text: "value"
}
| {
text: "new value"
}
or "new value" |
Number, Money | {
value: 10
}
or (in the case of table fields) {
value: 10,
sum: 50
}
| {
value: 42
}
or 42 |
Multiple choice | {
choice_id: 1,
choice_name: "Yes",
choice_ids: [1],
choice_names: ["Yes"]
}
or {
choice_ids: [2, 5, 7],
choice_names: ["Technology", "Art", "Business"]
}
| {
choice_id: 1
}
or {
choice_name: "Yes"
}
or {
choice_ids: [2, 5, 7]
}
or {
choice_names: ["Technology", "Art", "Business"]
}
|
| Date | {
date: "2020-01-31"
}
| {
date: "2020-01-05"
}
|
Due date | {
value: Date
}
| {
date: "2020-01-05"
}
or {
days_from_create: 10
}
|
Due date and time | {
value: Date
}
| {
date: "2020-01-05T10:30:00Z"
}
or {
hours_from_create: 10
}
|
| Due date and period | {
value: Date,
duration_minutes: 150
}
| {
date: "2020-01-05T10:30:00Z",
duration_minutes: 60
}
|
| Time | {
time: "17:33"
}
| {
time: "19:07"
}
|
Catalog | {
item_id: 123,
columns: {
"column name": "value"
}
}
or {
values: [
{
item_id: 123,
columns: {
"column name": "value for 123"
}
},
{
item_id: 129,
columns: {
"column name": "value for 129"
}
}
]
}
| {
item_name: "Value from the first column of the catalog"
}
or {
values: [
{
item_name: 'Lemon'
},
{
item_name: 'Kiwi'
}
]
}
|
| Files | {
files: [
{
id: -1,
name: "Document",
url: 'https://docs.google.com/document/fake_url'
},
{
id: 1234,
name: "Document.pdf",
url: "attachment?Id=1234"
}
]
}
| Is not supported |
| Contact | {
person_id: 123,
first_name: "John",
last_name: "Smith",
organization_id: 7,
organization_name: "Pear Inc.",
department_name: "Supply",
position_name: "Head of department",
work_phone: "+1(495)123-45-67",
email: "john_smith@gmail.com",
cell_phone: "+1(999)123-45-67"
}
| 123 |
Check Mark | {
checked: true
}
| "checked" or "unchecked" |
| Table | {
value: [
{
Id: 0,
Guid: '91eb510b-43c3-471a-8190-952c60be42f1'
},
{
Id: 1,
Guid: '2b9cb46c-c7ae-443f-860d-5f6fca58782d'
}
]
}
| Is not supported |