boltforms icon indicating copy to clipboard operation
boltforms copied to clipboard

choice selected element

Open redactive596 opened this issue 8 years ago • 2 comments

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?

    {{ 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

redactive596 avatar Sep 25 '17 12:09 redactive596

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.

rossriley avatar Sep 26 '17 09:09 rossriley

thank you

I found: preferred_choices

redactive596 avatar Oct 04 '17 12:10 redactive596