Hi,
ich habe eine Formular mit Bedingungen.
Unter anderem verwende ich vier Radio Options.
Je nach Auswahl öffnet sich danach ein spezifisches Set an Feldern.
Das Formular verwende ich auf verschiedenen Unterseiten.
Ich würde gern mit meinedomain.tld?Anlass=VALUE eine Vorauswahl treffen.
Ist weder Anlass vorhanden, noch stimmt Value überein möchte ich die Radio Buttons neutral stehen lassen.
Im Formular würde ich das Twig-Template für die Radio Gruppe ändern in etwas wie folgt
Leider klappt das nicht so.HTML-Code:{% extends '@Contao/form_radio.html.twig' %} {% block field %} {% set anlassValue = app.request.query.get('Anlass') %} {% for option in options %} {% if option.type == 'option' %} <span> <input type="radio" name="{{ option.name }}" id="opt_{{ option.id }}" class="radio" value="{{ option.value }}" {{ option.checked ? 'checked' }} {{ option.attributes }} {{ option.value == anlassValue ? 'checked' }} > <label id="lbl_{{ option.id }}" for="opt_{{ option.id }}">{{ option.label }}</label> </span> {% endif %} {% endfor %} {% endblock %}
Meine Conditional Field klappt mit diesem Template immer alles auf.
Egal was in der URL steht


Zitieren
