generated from strangebuzz/MicroSymfony
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathform.html.twig
70 lines (55 loc) · 1.88 KB
/
form.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{% extends 'base.html.twig' %}
{% set h2 = 'Form example' %}
{% block title %}{{ h2 }} | {{ brand }}{% endblock %}
{% block body %}
<div class="sub-heading">
<h2>{{ h2 }} 📋</h2>
</div>
<card>
<p>
This is a basic form example using a DTO, there are some constraints.
<a att="" href="https://www.strangebuzz.com/en/blog/disable-the-html5-validation-of-all-your-symfony-forms-with-a-feature-flag">
The browser validation is deactivated</a>, so you can easily test the
server side validation.
</p>
</card>
{% if form.vars.submitted and form.vars.valid %}
<card>
<h3>Submitted and valid values ✨</h3>
<table>
<tr>
<th>Name</th>
<td>{{ dto.name }}</td>
</tr>
<tr>
<th>Email</th>
<td>{{ dto.email }}</td>
</tr>
<tr>
<th>Country</th>
<td>{{ dto.country }}</td>
</tr>
<tr>
<th>Currency</th>
<td>{{ dto.currency }}</td>
</tr>
<tr>
<th>Birthay</th>
<td>{{ dto.birthday|date('Y-m-d') }}</td>
</tr>
<tr>
<th>Fruit</th>
<td>{{ dto.fruit.name }}</td>
</tr>
</table>
<a href="{{ path('app_form') }}" btn primary>Retry</a>
</card>
{% else %}
<h2>Create a new account 🔏</h2>
<p>* = required fields</p>
<fieldset>
<legend> Enter your information 🖋 </legend>
{{ form(form, {'attr': {'novalidate': 'novalidate'}}) }}
</fieldset>
{% endif %}
{% endblock %}