XF 2.0 Default value for option

CMTV

Well-known member
Hi!

I have a custom option template:
HTML:
<xf:radiorow name="{$inputName}[where]"
             label="{$option.title}"
             hint="{$hintHtml}"
             explain="{$explainHtml}"
             html="{$listedHtml}">

    <xf:option value="everywhere" selected="$option.option_value.where == 'everywhere'"
               label="{{ phrase('everywhere') }}" hint="{{ phrase('Math_render_everywhere_hint') }}" />

    <xf:option value="places" selected="$option.option_value.where == 'places'"
               label="{{ phrase('Math_in_certain_places') }}">

        <xf:checkbox>

            <xf:option name="{$inputName}[places][titles]" label="{{ phrase('Math_titles') }}" ... />

            <xf:option name="{$inputName}[places][content]" label="{{ phrase('Math_places_content') }}" ... />

            <xf:option name="{$inputName}[places][pages]" label="{{ phrase('pages') }}" ... />

            <xf:option name="{$inputName}[places][signatures]" label="{{ phrase('Math_signatures') }}" ... />

            <xf:option name="{$inputName}[places][about]" label="{{ phrase('about') }}" ... />

        </xf:checkbox>

    </xf:option>

</xf:radiorow>

By default the places radio option must be selected with all the checkboxes. What shoud I type in "Default value" field in option settings?
JSON:
{"where":"places","places": ??? What to put here??? }

So by default it should look like this:
1524401414557.webp
 
Solved the problem. Here is the right code:
JSON:
{
    "where":"places",
    "places":{
        "titles":"...desired value...",
        "content":"...",
        "pages":"...",
        "signatures":"...",
        "about":"..."},
}
 
Top Bottom