diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
index 0e562e4142..2aa0bc9967 100644
--- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
+++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
@@ -147,8 +147,9 @@
{% if widget == 'single_text' %}
{{ block('form_widget_simple') }}
{% else %}
+ {% set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} %}
- {{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %}
+ {{ form_widget(form.hour, vars) }}:{{ form_widget(form.minute, vars) }}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %}
{% endif %}
{% endspaceless %}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/time_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/time_widget.html.php
index 591bbf797a..42ed19ad5e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/time_widget.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/time_widget.html.php
@@ -1,17 +1,18 @@
block($form, 'form_widget_simple'); ?>
+ array('size' => 1)) : array() ?>
block($form, 'widget_container_attributes') ?>>
widget($form['hour'], array('attr' => array('size' => 1)));
+ echo $view['form']->widget($form['hour'], $vars);
echo ':';
- echo $view['form']->widget($form['minute'], array('attr' => array('size' => 1)));
+ echo $view['form']->widget($form['minute'], $vars);
if ($with_seconds) {
echo ':';
- echo $view['form']->widget($form['second'], array('attr' => array('size' => 1)));
+ echo $view['form']->widget($form['second'], $vars);
}
?>
diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
index aa3d46bf2e..8f809103e3 100644
--- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -1531,11 +1531,11 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
[
./select
[@id="name_hour"]
- [@size="1"]
+ [not(@size)]
[./option[@value="4"][@selected="selected"]]
/following-sibling::select
[@id="name_minute"]
- [@size="1"]
+ [not(@size)]
[./option[@value="5"][@selected="selected"]]
]
[count(./select)=2]
@@ -1555,17 +1555,17 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
[
./select
[@id="name_hour"]
- [@size="1"]
+ [not(@size)]
[./option[@value="4"][@selected="selected"]]
[count(./option)>23]
/following-sibling::select
[@id="name_minute"]
- [@size="1"]
+ [not(@size)]
[./option[@value="5"][@selected="selected"]]
[count(./option)>59]
/following-sibling::select
[@id="name_second"]
- [@size="1"]
+ [not(@size)]
[./option[@value="6"][@selected="selected"]]
[count(./option)>59]
]
@@ -1616,6 +1616,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
[@type="time"]
[@name="name"]
[@value="04:05"]
+ [not(@size)]
'
);
}