merged branch jalliot/file_widget (PR #2608)
Commits
-------
e83e00a
Fixed rendering of FileType (value is not a valid attribute for input[type=file])
Discussion
----------
Fixed rendering of FileType
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
According to the W3C validator, `value` is not a valid attribute for `input[type=file]`.
---------------------------------------------------------------------------
by fabpot at 2011/11/10 23:01:24 -0800
Instead of creating yet another block, what about modifying the `field_widget` to not render the `value` attribute if the value is empty? Also, the PHP template must be fixed too.
---------------------------------------------------------------------------
by jalliot at 2011/11/11 02:02:52 -0800
@fabpot Changed ;)
This commit is contained in:
commit
7f32043f19
@ -168,7 +168,7 @@
|
||||
{% block field_widget %}
|
||||
{% spaceless %}
|
||||
{% set type = type|default('text') %}
|
||||
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" />
|
||||
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
|
||||
{% endspaceless %}
|
||||
{% endblock field_widget %}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<input
|
||||
type="<?php echo isset($type) ? $view->escape($type) : "text" ?>"
|
||||
value="<?php echo $view->escape($value) ?>"
|
||||
<?php if (!empty($value)): ?>value="<?php echo $view->escape($value) ?>"<?php endif ?>
|
||||
<?php echo $view['form']->renderBlock('attributes') ?>
|
||||
/>
|
||||
|
@ -1386,7 +1386,6 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
|
||||
'/input
|
||||
[@type="password"]
|
||||
[@name="na&me"]
|
||||
[@value=""]
|
||||
'
|
||||
);
|
||||
}
|
||||
@ -1419,7 +1418,6 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase
|
||||
'/input
|
||||
[@type="password"]
|
||||
[@name="na&me"]
|
||||
[@value=""]
|
||||
[@maxlength="123"]
|
||||
'
|
||||
);
|
||||
|
Reference in New Issue
Block a user