Field values
When you query a value you always specify whether that value is optional or required:
document.field('default_settings').requiredStringValue();
document.field('extra_settings').optionalStringValue();
The optional*
query returns a value or null
, while the required*
query
throws a validation error if the value is missing, such as:
The field 'default_settings' must contain a value.
Line | Content
> 1 | default_settings:
Fieldset entry values
This works just like on a field:
document.fieldset('image').entry('src').requiredStringValue();
document.fieldset('image').entry('title').optionalStringValue();
Next page: List values