LimeSurvey version: 6.15.4+250710
Installation type: Own server
Custom theme/template: Yes — custom
question theme
Hi everyone,I'm trying to build a
custom question theme to capture an address block in a structured way:
- Row 1: Street and Suite/Apt fields side-by-side
- Row 2: City, Province, and Postal Code (each in one column)
This layout isn't available by default in LimeSurvey, so I created a custom question theme based on the
Code:
Multiple Short Text
type.However, there's a critical issue:
the answers are not being saved — nothing shows up in the response table, and no values are posted back.
What I noticed in the browser console:
- All
elements rendered without
and
attributes
-
returns
- The HTML looks like this for each field: <input type="text" id="" name="" class="form-control" placeholder="Street" value="">
My config.xml
<config>
<metadata>
<name>addressblock</name>
<type>question_theme</type>
<title>Address Block</title>
<creationDate>2025-07-23</creationDate>
<lastUpdate>2025-07-23</lastUpdate>
<author>Your Name</author>
<authorUrl>
your-site.example/
<authorEmail>your@email.com
<copyright>Copyright (C) 2025 Your Organization</copyright>
<license>GNU General Public License version 2 or later</license>
<version>1.0.0</version>
<apiVersion>1</apiVersion>
<lastSecurityUpdate>1.0.0</lastSecurityUpdate>
<questionType>Q</questionType>
<group>Text questions</group>
<subquestions>5</subquestions>
<answerscales>0</answerscales>
<description>
Collect an address with structured fields for street, suite, city, province, and postal code.
</description>
</metadata>
<compatibility>
<version>3.0</version>
<version>4.0</version>
<version>5.0</version>
<version>6.0</version>
</compatibility>
<files>
<css>
<filename>css/addressblock.css</filename>
</css>
<js>
<filename>js/addressblock.js</filename>
</js>
</files>
<attributes>
<attribute>
<name>placeholder_street</name>
<category>Display</category>
<inputtype>text</inputtype>
<default>Street Address</default>
<caption>Street field placeholder</caption>
</attribute>
<attribute>
<name>placeholder_suite</name>
<category>Display</category>
<inputtype>text</inputtype>
<default>Apt/Suite</default>
<caption>Suite field placeholder</caption>
</attribute>
<attribute>
<name>placeholder_city</name>
<category>Display</category>
<inputtype>text</inputtype>
<default>City</default>
<caption>City field placeholder</caption>
</attribute>
<attribute>
<name>placeholder_province</name>
<category>Display</category>
<inputtype>text</inputtype>
<default>Province</default>
<caption>Province field placeholder</caption>
</attribute>
<attribute>
<name>placeholder_postal</name>
<category>Display</category>
<inputtype>text</inputtype>
<default>Postal Code</default>
<caption>Postal code field placeholder</caption>
</attribute>
</attributes>
<engine>
<load_core_css>true</load_core_css>
<load_core_js>true</load_core_js>
<show_as_template>true</show_as_template>
<show_as_question_type>true</show_as_question_type>
</engine>
</config>
My answer.twig
{% block answer %}
<div class="address-block">
<div class="row">
{% for subquestion in subquestions %}
{% if loop.index0 == 0 %}
<div class="form-group col-md-8">
<label for="{{ subquestion.sgqa }}">Street</label>
<input type="text" class="form-control" id="{{ subquestion.sgqa }}" name="{{ subquestion.sgqa }}" value="{{ subquestion.answer }}" placeholder="{{ question_template_attribute.placeholder_street }}">
</div>
{% elseif loop.index0 == 1 %}
<div class="form-group col-md-4">
<label for="{{ subquestion.sgqa }}">Suite</label>
<input type="text" class="form-control" id="{{ subquestion.sgqa }}" name="{{ subquestion.sgqa }}" value="{{ subquestion.answer }}" placeholder="{{ question_template_attribute.placeholder_suite }}">
</div>
{% elseif loop.index0 == 2 %}
<div class="form-group col-md-4">
<label for="{{ subquestion.sgqa }}">City</label>
<input type="text" class="form-control" id="{{ subquestion.sgqa }}" name="{{ subquestion.sgqa }}" value="{{ subquestion.answer }}" placeholder="{{ question_template_attribute.placeholder_city }}">
</div>
{% elseif loop.index0 == 3 %}
<div class="form-group col-md-4">
<label for="{{ subquestion.sgqa }}">Province</label>
<input type="text" class="form-control" id="{{ subquestion.sgqa }}" name="{{ subquestion.sgqa }}" value="{{ subquestion.answer }}" placeholder="{{ question_template_attribute.placeholder_province }}">
</div>
{% elseif loop.index0 == 4 %}
<div class="form-group col-md-4">
<label for="{{ subquestion.sgqa }}">Postal Code</label>
<input type="text" class="form-control" id="{{ subquestion.sgqa }}" name="{{ subquestion.sgqa }}" value="{{ subquestion.answer }}" placeholder="{{ question_template_attribute.placeholder_postal }}">
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endblock %}Question:Why are the input fields not being bound correctly to subquestions (no
,
, or values), and how can I fix this so that responses are captured?Any tips appreciated — especially if I missed something in the
or
.Thanks in advance!