boltforms
boltforms copied to clipboard
choice selected element
Hello,
I use type: choice
And to that I have a question.
- How to select the selected item
choice_simple:
type: choice
options:
label: A very simple choice
choices: { 'Item One': 'item_1', 'Item Two': 'item_2' }
For example, I would like the selected item to be:
'Item Two': 'item_2'
I know enough to change the order, but what if the elements are a lot?
or
best_pet_page:
type: choice
options:
required: false
label: What is our best pets page?
choices: content
sort: title
limit: 50
I get them from the database?
Is there maybe a parameter or or other solution?
{{ boltforms('form_name',
defaults = {
field_1: "value_1",
field_2: "value_2",
field_3: "value_3"
})
}}
how to set defaults for field type choice, and exactly:
choice_simple:
type: choice
options:
label: A very simple choice
choices: { 'Item One': 'item_1', 'Item Two': 'item_2' }
Regards
Have a look at this section in the docs: https://github.com/bolt/boltforms/blob/4.1/doc/fields.md#choice-types
See the usage of the data attribute. Hopefully this is what you are after.
thank you
I found: preferred_choices