Forum

Thread tagged as: Question, Problem, Field-Types

Save selection for radio template tag

Hi guys,

I'm am using radio buttons along with the <perch:if> tags to show/hide a part of my template, which works fine. However, if I save the region and then come back to edit something, I have to select again the options on my radio buttons or that part of my template won't show up in the front. Is there something I can do to save it's value and only change it if I really want to change it?

Thanks

Miguel Corrales

Miguel Corrales 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us your template?

Sure.

 <perch:content id="amenities-lang" type="radio" label="Language" options="English | en, Español | es" suppress="true" />

            <perch:if id="amenities-lang" match="eq" value="{en}">
                <perch:repeater id="amenities-en" label="Amenities">
                    <perch:before><ul class="bullets clearfix"></perch:before>
                        <li><perch:content id="amenities-list_en"
                            type="select"
                            label="Select from the list"
                            allowempty="true"
                            options="1,2,3" />
                        </li>
                    <perch:after></ul></perch:after>
                </perch:repeater>
            </perch:if>

            <perch:if id="amenities-lang" match="eq" value="{es}">
                <perch:repeater id="amenities-es" label="Amenidades">
                    <perch:before><ul class="bullets clearfix"></perch:before>
                        <li><perch:content id="amenities-list_es"
                            type="select"
                            label="Selecciona de la lista"
                            allowempty="true"
                            options="1,2,3" />
                        </li>
                    <perch:after></ul></perch:after>
                </perch:repeater>
            </perch:if>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Try tiding up the whitespace:

options="English|en, Español|es"

You also have dashes in your IDs, which are technically illegal.

Thanks Drew! It's working great now.

I missed that info about the ID's but I'm going to fix them all now. Thanks :)