Skip to content

Commit

Permalink
Work on autocomplete, checked_input, checked_password and money_input…
Browse files Browse the repository at this point in the history
…, regarding errors and required
  • Loading branch information
trollfot committed Nov 22, 2023
1 parent 1530110 commit 5bd7781
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
4 changes: 3 additions & 1 deletion deform/templates/autocomplete_input.pt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<span tal:define="name name|field.name;
css_class css_class|field.widget.css_class;
error_class error_class|field.widget.error_class;
oid oid|field.oid;
style style|field.widget.style;
autofocus autofocus|field.autofocus"
Expand All @@ -8,9 +9,10 @@
name="${name}"
value="${cstruct}"
data-provide="typeahead"
tal:attributes="class string: form-control ${css_class or ''};
tal:attributes="class string:form-control ${field.error and error_class or css_class};
style style;
autofocus autofocus;
required field.required and 'required' or None;
attributes|field.widget.attributes|{};"
id="${oid}"/>
<script tal:condition="field.widget.values" type="text/javascript">
Expand Down
2 changes: 2 additions & 0 deletions deform/templates/checked_input.pt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
${field.start_mapping()}
<div class="mb-3 ${field.error and 'is-invalid' or None}">
<input type="text" name="${name}" value="${cstruct}"
i18n:attributes="placeholder"
tal:attributes="style style;
class string:form-control ${field.error and error_class or css_class};
placeholder subject;
Expand All @@ -21,6 +22,7 @@
</div>
<div class="mb-3 ${field.error and 'is-invalid' or None}">
<input type="text" name="${name}-confirm" value="${confirm}"
i18n:attributes="placeholder"
tal:attributes="style style;
class string:form-control ${field.error and error_class or css_class};
required field.required and 'required' or None;
Expand Down
53 changes: 28 additions & 25 deletions deform/templates/checked_password.pt
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
<div i18n:domain="deform" tal:omit-tag=""
tal:define="oid oid|field.oid;
name name|field.name;
error_class error_class|field.widget.error_class;
css_class css_class|field.widget.css_class;
style style|field.widget.style;
autofocus autofocus|field.autofocus">
${field.start_mapping()}
<div>
<input type="password"
name="${name}"
value="${field.widget.redisplay and cstruct or ''}"
tal:attributes="class string: form-control ${css_class or ''};
style style;
autofocus autofocus;
attributes|field.widget.attributes|{};"
id="${oid}"
i18n:attributes="placeholder"
placeholder="Password"/>
</div>
<div>
<input type="password"
name="${name}-confirm"
value="${field.widget.redisplay and confirm or ''}"
tal:attributes="class string: form-control ${css_class or ''};
style style;
confirm_attributes|field.widget.confirm_attributes|{};"
id="${oid}-confirm"
i18n:attributes="placeholder"
placeholder="Confirm Password"/>
</div>
${field.end_mapping()}
${field.start_mapping()}
<div class="mb-3 ${field.error and 'is-invalid' or None}">
<input type="password"
name="${name}"
value="${field.widget.redisplay and cstruct or ''}"
tal:attributes="class string: form-control ${css_class or ''};
style style;
autofocus autofocus;
required field.required and 'required' or None;
attributes|field.widget.attributes|{};"
id="${oid}"
i18n:attributes="placeholder"
placeholder="Password"/>
</div>
<div class="mb-3 ${field.error and 'is-invalid' or None}">
<input type="password"
name="${name}-confirm"
value="${field.widget.redisplay and confirm or ''}"
tal:attributes="class string: form-control ${css_class or ''};
style style;
required field.required and 'required' or None;
confirm_attributes|field.widget.confirm_attributes|{};"
id="${oid}-confirm"
i18n:attributes="placeholder"
placeholder="Confirm Password"/>
</div>
${field.end_mapping()}
</div>
4 changes: 3 additions & 1 deletion deform/templates/moneyinput.pt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
name name|field.name;
mask_options mask_options|'{}';
style style|field.widget.style;
error_class error_class|field.widget.error_class;
css_class css_class|field.widget.css_class;
style style|field.widget.style|False;
autofocus autofocus|field.autofocus"
tal:omit-tag="">
<input type="text" name="${name}" value="${cstruct}"
tal:attributes="style style;
class string: form-control ${css_class or ''};
class string:form-control ${field.error and error_class or css_class};
autofocus autofocus;
required field.required and 'required' or None;
attributes|field.widget.attributes|{};"
id="${oid}"/>
<script type="text/javascript">
Expand Down

0 comments on commit 5bd7781

Please sign in to comment.