Skip to content

Commit 8d72799

Browse files
authored
Oprava vykreslování checkboxů (#768)
* oprava vykreslovani checkboxu * recaptcha error
1 parent ac6b3db commit 8d72799

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

app/WebModule/Forms/templates/additional_information_form.latte

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@
2626
{/if}
2727

2828
<div class="col-md-9">
29-
{input $c}
29+
{if !$c instanceof Nette\Forms\Controls\Checkbox}
30+
{input $c}
31+
{else}
32+
<div class="form-check">
33+
<label class="form-check-label" for="{$c->htmlId}">
34+
<input type="checkbox" n:name="$c->name" class="form-check-input">
35+
{_$c->caption}
36+
</label>
37+
</div>
38+
{/if}
3039
</div>
3140
</div>
3241
{/if}

app/WebModule/Forms/templates/contact_form.latte

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="form-group row">
33
{var $nameInput = $form->getComponent('name')}
44
<div class="col-md-3 col-form-label">
5-
<label for="{$nameInput->htmlId}" class="{$nameInput->required ? required}">
5+
<label for="{$nameInput->htmlId}" n:class="$nameInput->required ? required">
66
{_$nameInput->caption}
77
</label>
88
</div>
@@ -14,7 +14,7 @@
1414
<div class="form-group row">
1515
{var $emailInput = $form->getComponent('email')}
1616
<div class="col-md-3 col-form-label">
17-
<label for="{$emailInput->htmlId}" class="{$emailInput->required ? required}">
17+
<label for="{$emailInput->htmlId}" n:class="$emailInput->required ? required">
1818
{_$emailInput->caption}
1919
</label>
2020
</div>
@@ -26,7 +26,7 @@
2626
<div class="form-group row">
2727
{var $messageInput = $form->getComponent('message')}
2828
<div class="col-md-3 col-form-label">
29-
<label for="{$messageInput->htmlId}" class="{$messageInput->required ? required}">
29+
<label for="{$messageInput->htmlId}" n:class="$messageInput->required ? required">
3030
{_$messageInput->caption}
3131
</label>
3232
</div>
@@ -38,17 +38,22 @@
3838
<div class="form-group row">
3939
{var $sendCopyInput = $form->getComponent('sendCopy')}
4040
<div class="col-md-9 offset-3">
41-
{input $sendCopyInput}
41+
<div class="form-check">
42+
<label class="form-check-label" for="{$sendCopyInput->htmlId}">
43+
<input type="checkbox" n:name="$sendCopyInput->name" class="form-check-input">
44+
{_$sendCopyInput->caption}
45+
</label>
46+
</div>
4247
</div>
4348
</div>
4449

4550
{var $recaptcha = $form->getComponent('recaptcha', false)}
4651
<div n:if="$recaptcha" class="form-group row">
4752
<div class="col-9 offset-3">
48-
<div n:name="recaptcha"></div>
49-
<span class="help-block text-danger" n:if="$form['recaptcha']->getError()">
53+
<div n:name="$recaptcha->name"></div>
54+
<span class="help-block text-danger" n:if="$recaptcha->error">
5055
<i class="fa fa-exclamation-circle"></i>
51-
{$form['recaptcha']->getError()}
56+
{$recaptcha->error}
5257
</span>
5358
</div>
5459
</div>

0 commit comments

Comments
 (0)