form.pt
3.57 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<html metal:use-macro="load: base.pt">
<div metal:fill-slot="content">
<style>
button {
margin:0px 3px;
}
#main{min-height: 1px;
padding-bottom: 1px;}
</style>
</div>
<div metal:fill-slot="scripts">
<div class="panel-body col-md-12">
<div class="col-md-6 col-md-offset-3 col-xs-12 well">
<!-- Proses Template Form -->
<form method="post" accept-charset="utf-8" id="deform" class="form-horizontal"
enctype="multipart/form-data" tal:define="field form"
style="background-color:white;"
autocomplete="off">
<input type="hidden" name="_charset_">
<input type="hidden" value="deform" name="__formid__">
<!-- Tampilan untuk general error -->
<div class="alert alert-danger" tal:condition="field.error">
<div class="errorMsgLbl" i18n:translate="">
Terdapat kesalahan pengisian
</div>
<p class="errorMsg">${field.errormsg}</p>
</div>
<!-- END Tampilan untuk general error -->
<div class="col-md-12">
<!-- Looping Semua Field-->
<div tal:repeat="f form">
<div tal:condition="f.widget.hidden">
<!-- Proses Saat Field hidden-->
${structure:f.serialize()}
</div>
<div tal:condition="not f.widget.hidden and not f.children"
class="form-group" >
<!-- Proses Saat Field Normal dan bukan Children-->
<!-- Field Reqired menggunakan class required -->
<label for="${f.oid}"
class="control-label col-md-4 ${f.required and 'required' or ''}"
id="req-${f.oid}">
${f.title}</label>
<div class="col-md-8">
${structure:f.serialize()}
<p tal:condition="f.error" id="error-${f.oid}" class="help-block"
tal:repeat="error f.error.messages()">
${error}</p>
</div>
</div>
<div tal:condition="f.children and f.name=='upload_files'">
<!-- Proses saat Form Adalah File Upload-->
${f.start_sequence()}
${structure:f.serialize()}
${f.end_sequence()}
</div>
<div tal:condition="f.children and f.name!='upload_files'">
<!-- Proses saat Form Adalah Children -->
${f.start_mapping()}
<div tal:repeat="g f.children" class="form-group" >
<label for="${g.oid}"
class="control-label col-md-4 ${g.required and 'required' or ''}"
id="req-${g.oid}">
${g.title}</label>
<div class="col-md-8">
${structure:g.serialize()}
<p tal:condition="g.error" id="error-${g.oid}" class="help-block"
tal:repeat="error g.error.messages()">
${error}</p>
</div>
</div>
${f.end_mapping()}
</div>
</div>
<div class="input-group-btn">
<button tal:repeat="fb form.buttons" type="${fb.type}"
class="btn ${fb.css_class} pull-right"
name="${fb.name}">${fb.title}</button>
</div>
</div>
</form>
<!-- End Template Form -->
<!-- </div> -->
</div>
</div>
<script>
${params.scripts}
</script>
</div>
</html>