config: added custom html insertion and separated name and title

This commit is contained in:
2025-12-01 18:54:09 +01:00
parent bdfa359702
commit 4045779947
2 changed files with 14 additions and 3 deletions
+8 -3
View File
@@ -3,11 +3,13 @@
{% block title %}Form{% endblock %}
{% block content %}
<h1>Dynamic Form</h1>
<form action="/submit" method="POST" autocomplete="off">
{% for f in fields %}
{% if f.html_before.is_some() %}
{{ f.html_before.as_ref().unwrap() | safe }}
{% endif %}
<div class="field">
<label for="{{ f.name }}">{{ f.description }}</label>
<label>{{ f.title }}</label>
<div class="desc">{{ f.description }}</div>
{% if f.answer_type == "textarea" %}
<textarea id="{{ f.name }}" name="{{ f.name }}" rows="5"></textarea>
@@ -17,8 +19,11 @@
<input id="{{ f.name }}" name="{{ f.name }}" type="{{ f.answer_type }}">
{% endif %}
</div>
{% if f.html_after.is_some() %}
{{ f.html_after.as_ref().unwrap() | safe }}
{% endif %}
{% endfor %}
<div><button type="submit">Submit</button></div>
<div><button type="submit">{{ submit_button }}</button></div>
</form>
{% endblock %}