/
form.pt
73 lines (62 loc) · 2.07 KB
/
form.pt
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
<form
id="${field.formid}"
action="${field.action}"
method="${field.method}"
enctype="multipart/form-data"
accept-charset="utf-8"
i18n:domain="deform"
tal:attributes="class field.css_class">
<fieldset class="deformFormFieldset">
<legend tal:condition="field.title">${field.title}</legend>
<input type="hidden" name="_charset_" />
<input type="hidden" name="__formid__" value="${field.formid}"/>
<ul>
<li class="errorLi" tal:condition="field.error">
<h3 class="errorMsgLbl" i18n:translate=""
>There was a problem with your submission</h3>
<p class="errorMsg" i18n:translate=""
>Errors have been highlighted below</p>
</li>
<li class="section first" tal:condition="field.title">
<h3>${field.title}</h3>
<div tal:condition="field.description">${field.description}</div>
</li>
<div
tal:define="rndr field.renderer;
tmpl field.widget.item_template"
tal:repeat="f field.children"
tal:replace="structure
rndr(tmpl,field=f,cstruct=cstruct.get(f.name, null))"/>
<li class="buttons">
<tal:block repeat="button field.buttons">
<button
id="${field.formid+button.name}"
name="${button.name}"
type="${button.type}"
class="btnText submit"
value="${button.value}">
<span>${button.title}</span>
</button>
</tal:block>
</li>
</ul>
</fieldset>
<script type="text/javascript" tal:condition="field.use_ajax">
deform.addCallback(
'${field.formid}',
function(oid) {
var options = {
target: '#' + oid,
replaceTarget: true,
};
var extra_options = ${field.ajax_options};
var name;
if (extra_options) {
for (name in extra_options) {
options[name] = extra_options[name];
};
};
$('#' + oid).ajaxForm(options);
});
</script>
</form>