Skip to content

Commit e83e00a

Browse files
committed
Fixed rendering of FileType (value is not a valid attribute for input[type=file])
1 parent f8164ec commit e83e00a

3 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
{% block field_widget %}
169169
{% spaceless %}
170170
{% set type = type|default('text') %}
171-
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" />
171+
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
172172
{% endspaceless %}
173173
{% endblock field_widget %}
174174

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<input
22
type="<?php echo isset($type) ? $view->escape($type) : "text" ?>"
3-
value="<?php echo $view->escape($value) ?>"
3+
<?php if (!empty($value)): ?>value="<?php echo $view->escape($value) ?>"<?php endif ?>
44
<?php echo $view['form']->renderBlock('attributes') ?>
55
/>

tests/Symfony/Tests/Component/Form/AbstractLayoutTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,6 @@ public function testPassword()
13861386
'/input
13871387
[@type="password"]
13881388
[@name="na&me"]
1389-
[@value=""]
13901389
'
13911390
);
13921391
}
@@ -1419,7 +1418,6 @@ public function testPasswordWithMaxLength()
14191418
'/input
14201419
[@type="password"]
14211420
[@name="na&me"]
1422-
[@value=""]
14231421
[@maxlength="123"]
14241422
'
14251423
);

0 commit comments

Comments
 (0)