In Contact Form, I need to have a Select field, with options, that are children of “Services” page.
Is it necessary to specify all option in markdown file?
I tried to overwrite user\plugins\form\templates\forms\fields\select\select.html.twig file with a loop, that would gather all pages, and write them to option tags:
....
{% set service_array = [] %}
{% for item in pages.find('/services').children %}
{% set service_array = service_array|merge( { (item.header.heading):(item.header.heading) } ) %}
{% endfor %}
{% for key, item_value in service_array %}
<option value="{{ key}}">
{{ item_value }}
</option>
{% endfor %}
....
After selecting some option in contact form and pressing submit, the request file is generated in:
/user/data/home-form folder, with the option that was selected, but email is sent without this value. I think it’s because i haven’t specified these select options in my Markdown file
What would be the easiest way to write this Select?