bolt / bolt/boltforms

choice selected element

Open
#194 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
52
Forks
54
PR merge metrics
No merged PRs in 30d

Description

Hello,

I use type: choice

And to that I have a question.

1) 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?

2)
```
{{ 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.