scripts:field-value-formats

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_id: 1
}
or
{
  choice_name: "Yes"
}
Due date
{
  date: "2020-01-01"
}
{
  date: "2020-01-05"
}
or
{
  days_from_create: 10
}
Due date and time
{
  date_time: "2020-01-01T10:30:00Z"
}
{
  date_time: "2020-01-05T10:30:00Z"
}
or
{
  hours_from_create: 10
}
Catalog
{
  item_id: 123,
  columns: {
    "column name": "value"
  }
}

Was this article helpful?

Yes, thanks! No, I have a question