Add radio options

User
OptionsetField::create('QualitatDerWohnung', 'Qualität der Wohnung', [
'option1' => 'option1',
'option2' => 'option2',
'option3' => 'option3',
])->setTitle('Qualität der Wohnung')
read all radio options and add in above with value and lable will same
Assistant
Got it ✅
From your screenshot, the **"Qualität der Wohnung"** section has the following radio options:

– Neubau
– Einfach
– Gehobene
– Normal
– Luxe

So your SilverStripe `OptionsetField` should look like this:

OptionsetField::create(
    'QualitatDerWohnung',
    'Qualität der Wohnung',
    [
        'Neubau'  => 'Neubau',
        'Einfach' => 'Einfach',
        'Gehoben' => 'Gehoben',
        'Normal'  => 'Normal',
        'Luxe'    => 'Luxe',
    ]
)

👉 Here, both the **value** and the **label** are the same, exactly as shown in your design.

Do you also want me to prepare the **other "Details" section radio fields** (Einbauküche, Balkon/Terrasse, Gäste WC, etc.) in the same way?

User
also add options from Details:
Assistant
Perfect 👍 I’ll combine everything you see under **Details** and **Qualität der Wohnung** into proper `OptionsetField`s with values and labels the same.

From your screenshot, the options are:

**Details:**
– Einbauküche
– Balkon/Terrasse
– Gäste WC
– WG geeignet
– Aufzug
– Garten
– Keller
– Stufenlose Zugang
– Wohnberechtigungsschein
– Haustiere erlaubt

**Qualität der Wohnung:**
– Neubau
– Einfach
– Gehobene
– Normal
– Luxe

Here’s the SilverStripe code:

use SilverStripeFormsOptionsetField;

// Details
OptionsetField::create(
    'Details',
    'Details',
    [
        'Einbauküche'            => 'Einbauküche',
        'Balkon/Terrasse'        => 'Balkon/Terrasse',
        'Gäste WC'               => 'Gäste WC',
        'WG geeignet'            => 'WG geeignet',
        'Aufzug'                 => 'Aufzug',
        'Garten'                 => 'Garten',
        'Keller'                 => 'Keller',
        'Stufenlose Zugang'      => 'Stufenlose Zugang',
        'Wohnberechtigungsschein'=> 'Wohnberechtigungsschein',
        'Haustiere erlaubt'      => 'Haustiere erlaubt',
    ]
),

// Qualität der Wohnung
OptionsetField::create(
    'QualitatDerWohnung',
    'Qualität der Wohnung',
    [
        'Neubau'  => 'Neubau',
        'Einfach' => 'Einfach',
        'Gehoben' => 'Gehoben',
        'Normal'  => 'Normal',
        'Luxe'    => 'Luxe',
    ]
)

⚡ Question: Do you want **all “Details” options** to be grouped in a **single OptionsetField** (user can pick only one) — or should each (Einbauküche, Balkon, etc.) be its **own Yes/No field**?

Because in your screenshot, they look more like **checkboxes (yes/no)** rather than a single exclusive choice.

Leave a Comment

Your email address will not be published. Required fields are marked *