File: form_in_one.tt

package info (click to toggle)
libhtml-formhandler-perl 0.40057-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,320 kB
  • ctags: 685
  • sloc: perl: 8,849; makefile: 2
file content (118 lines) | stat: -rw-r--r-- 4,140 bytes parent folder | download | duplicates (5)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
[% PROCESS form_start -%]
<div class="form_messages">
[% FOREACH err IN form.form_errors -%]
<span class="error_message">[% err %]</span>
[% END -%]
</div>
[% FOREACH f IN form.sorted_fields -%]
[% WRAPPER "wrapper_${f.uwrapper}" -%][% PROCESS "${f.uwidget}" -%][% END -%]
[% END -%]
[% PROCESS form_end -%]

[% BLOCK form_start -%]
<form[% process_attrs(form.attributes) %]>
[% END -%]

[% BLOCK form_end -%]
</form>
[% END -%]

[% BLOCK button -%]
<input type="button" name="[% f.html_name %]" id="[% f.id %]"[% process_attrs(f.attributes) %] value="[% f.value %]" />
[% END -%]

[% BLOCK checkbox -%]
<input type="checkbox" name="[% f.html_name %]" id="[% f.id %]"[% process_attrs(f.attributes) %] value="[% f.checkbox_value -%]"[% IF f.fif == f.checkbox_value -%] checked="checked"[% END ~%] />[%~ ~%]
[% END -%]

[% BLOCK checkbox_group -%]
[% FOR option IN f.options -%]
<label class="checkbox" for="[% f.name %].[% loop.index %]">
<input type="checkbox" value="[% option.value %]" name="[% f.name %]" id="[% f.name %].[% loop.index %]"[% FOREACH selval IN f.fif -%][% IF selval == option.value %] checked="checked"[% END -%][% END -%]>
[% option.label | html %]
</label>
[% END -%]
[% END -%]

[% BLOCK compound -%]
[% FOREACH sf IN f.sorted_fields -%]
[% outerf = f; f = sf; -%]
[% WRAPPER "wrapper_${f.uwrapper}" %][% PROCESS "${f.uwidget}" -%][% END -%]
[% f = outerf -%]
[% END -%]
[% END -%]

[% BLOCK hidden -%]
<input type="hidden" name="[% f.html_name %]" id="[% f.id %]"[% process_attrs(f.attributes) %] value="[% f.fif %]" />
[% END -%]

[% BLOCK password -%]
<input type="password" name="[% f.html_name %]" id="[% f.id %]"[% process_attrs(f.attributes) %] value="[% f.fif %]" />
[% END -%]

[% BLOCK radio_group -%]
[% FOR option IN f.options -%]
  <label for="[% f.id %].[% loop.index %]"><input type="radio" value="[% option.value %]" name="[% f.name %]" id="[% f.id %].[% loop.index %]" [% IF option.value == f.fif %] checked="checked"[% END %] />[% option.label %]</label>
[% END -%]
[% END -%]

[% BLOCK repeatable -%]
[% FOREACH rf IN f.sorted_fields -%]
[% outerrf = f; f = rf; -%]
[% WRAPPER "wrapper_${f.uwrapper}" %][% PROCESS "${f.uwidget}" -%][% END -%]
[% f = outerrf -%]
[% END -%]
[% END -%]

[% BLOCK reset -%]
<input type="reset" name="[% f.html_name %]" id="[% f.id %]"[% process_attrs(f.attributes) %] value="[% f.value %]" />
[% END -%]

[% BLOCK select -%]
<select name="[% f.html_name %]" id="[% f.id %]"[% process_attrs(f.attributes) %][% IF f.multiple %] multiple="multiple" size="[% f.size %]" [% END -%]>
  [% FOR option IN f.options -%]
  <option id="[% f.id %].[% loop.index %]" value="[% option.value -%]"[% FOREACH selval IN f.fif -%][% IF selval == option.value %] selected="selected"[% END -%][% END -%]>[% option.label | html %]</option>
  [% END -%]
</select>
[% END -%]

[% BLOCK submit -%]
<input type="submit" name="[% f.html_name %]" id="[% f.id %]"[% process_attrs(f.attributes) %] value="[% f.value %]" />
[% END -%]

[% BLOCK text -%]
<input type="[% f.input_type %]" name="[% f.html_name %]" id="[% f.id %]"[% process_attrs(f.attributes) %] value="[% f.fif %]" />
[% END -%]

[% BLOCK textarea -%]
<textarea name="[% f.html_name %]" id="[% f.id %]" rows="[% f.rows %]" cols="[% f.cols %]" [% process_attrs(f.attributes) %]>[% f.fif %]</textarea>
[% END -%]

[% BLOCK upload -%]
<input type="file" name="[% f.html_name %]" id="[% f.html_name %]"[% process_attrs(f.attributes) %] />
[% END -%]

[% BLOCK wrapper_simple -%]
<div[% process_attrs(f.wrapper_attributes) -%]>
[% IF f.do_label %][% PROCESS label %][% END -%]
[% content -%]
</div>
[% END -%]

[% BLOCK label -%]
<label [% process_attrs(f.label_attributes) %]for="[% f.html_name %]">[% f.label %]</label>
[% END -%]

[% BLOCK wrapper_wrap_label -%]
<div[% process_attrs(f.wrapper_attributes) %]><label[% process_attrs(f.label_attributes) %] for="[% f.html_name %]">[%~ content ~%][%~ f.label %]</label></div>
[% END -%]

[% BLOCK wrapper_none -%]
[% content %]
[% END -%]

[% BLOCK wrapper_fieldset -%]
<fieldset[% process_attrs(f.wrapper_attributes)%]><legend>[% f.label %]</legend>
[% content -%]
</fieldset>
[% END -%]