我有从数据库加载的复选框的表单(我使用实体字段类型)。复选框是区域和区域。我有以下数据库架构:
+-----------------------------------+
| id | parent_id | name |
+-----------------------------------+
| 1 | NULL | Region |
+-----------------------------------+
| 2 | 1 | District |
+-----------------------------------+
| 3 | 1 | Another district |
+-----------------------------------+
| 4 | NULL | Another region |
+-----------------------------------+
| 5 | 4 | Next district |
+-----------------------------------+
问题是我需要以下表格。怎么做?
<b>Region</b><!-- Loaded from database -->
<!-- Dictricts ordered by name -->
<input type="checkbox" id="someId" value="3"><label for="someId">Another district</label>
<input type="checkbox" id="someId" value="2"><label for="someId">District</label>
<b>Another region</b><!-- Loaded from database -->
<!-- Dictricts ordered by name -->
<input type="checkbox" id="someId" value="5"><label for="someId">Next district</label>
答案 0 :(得分:1)
感谢this post我通过自定义呈现表单模板解决了这个问题。
答案 1 :(得分:0)
EntityType字段: