8000 [Form] Add allow_html5 option to date and time FormType to disable HTML5 input type by csanquer · Pull Request #8291 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Add allow_html5 option to date and time FormType to disable HTML5 input type #8291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2014
Merged

[Form] Add allow_html5 option to date and time FormType to disable HTML5 input type #8291

merged 1 commit into from
Sep 23, 2014

Conversation

csanquer
Copy link
Contributor

[Form] added allow_html5 option to date and time FormType to disable HTML5 input type when widget is set to single_text

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #6927 #7123
License MIT
Doc PR

With this little patch we can have a single text widget without HTML5 date input type which is required when using some javascript date or time picker .

@hason
Copy link
Contributor
hason commented Jul 19, 2013

👍

@pilotci
Copy link
pilotci commented Dec 4, 2013

I think this is related to this #7123 👶

@pilotci
Copy link
pilotci commented Dec 4, 2013

@csanquer could you please add this ticket number to the table on the description if it fixes it too? 👶 thanks, ~ cordoval

@csanquer
Copy link
Contributor Author
csanquer commented Dec 4, 2013

done

@fabpot
Copy link
Member
fabpot commented Dec 29, 2013

@bschussek Can you have a look at this one?

@kix
Copy link
Contributor
kix commented Mar 27, 2014

@fabpot, seems like you've confused @webmozart's nickname :)
+1 here, we need a way to disable HTML5 widgets somehow.

@wouterj
Copy link
Member
wouterj commented Mar 27, 2014

well, three months ago his nickname was @bschussek :)

@webmozart webmozart changed the title add allow_html5 option to date and time FormType to disable HTML5 input type [Form] Add allow_html5 option to date and time FormType to disable HTML5 input type Apr 8, 2014
@csanquer
Copy link
Contributor Author

@fabpot I rebased the PR on master.

I know this PR is quite old but still useful, because the HTML5 date input lacks of real support even in latest browser version and jquery plugin like bootstrap-datetimepicker need an input text.

Is there anything wrong that prevent merging I can fix ?

@@ -93,7 +93,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
}

if ('single_text' === $options['widget']) {
if (self::HTML5_FORMAT === $pattern) {
if ($options['allow_html5'] && self::HTML5_FORMAT === $pattern) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this change. If your format is the HTML5 one, the right transformer should be used even if you don't use the HTML5 type when rendering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum, i think you're right , this new option allow_html5 is really used to prevent setting view variable type to HTML5 date, time or datetime,

Changing the data transformer is not really needed when allow_html5 is set to false.

@csanquer
Copy link
Contributor Author

I fixed the test for initializing the data transformer and i rebased with 8000 squashing over master.

It is ready for merge.

…e input when widget is set to single_text

remove unnecessary test when creating datetime format data transformer
@csanquer
Copy link
Contributor Author

@fabpot @stof I rebased on latest master.
On travis the unit tests failed only on some PHP version and for components other than Form which is the only component modified by this PR.

Can you merge this PR however ?

@stof
Copy link
Member
stof commented Aug 14, 2014

👍

1 similar comment
@fabpot
Copy link
Member
fabpot commented Sep 23, 2014

👍

@fabpot
Copy link
Member
fabpot commented Sep 23, 2014

Thank you @csanquer.

@fabpot fabpot merged commit 392d6c7 into symfony:master Sep 23, 2014
fabpot added a commit that referenced this pull request Sep 23, 2014
… to disable HTML5 input type (csanquer)

This PR was merged into the 2.6-dev branch.

Discussion
----------

[Form] Add allow_html5 option to date and time FormType to disable HTML5 input type

[Form] added allow_html5 option to date and time FormType to disable HTML5 input type when widget is set to single_text

| Q                    | A
| --------------------- | ---
| Bug fix?          | no
| New feature?   | yes
| BC breaks?     | no
| Deprecations? | no
| Tests pass?    | yes
| Fixed tickets   | #6927 #7123
| License           | MIT
| Doc PR           |

With this little patch we can have a single text widget without HTML5 date input type which is required when using some javascript date or time picker .

Commits
-------

392d6c7 add allow_html5 option to date and time FormType to disable HTML5 date input when widget is set to single_text
fabpot added a commit that referenced this pull request Sep 23, 2014
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Form] Changed "allow_html5" to "html5"

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This is a follow-up to #8291, which I missed before it was merged. IMO "allow_html5" is a confusing name. We don't "allow" HTML5, but we use it - or we don't. I think "html5" conveys that meaning well and is shorter at the same time.

Commits
-------

ad171be [Form] Changed "allow_html5" to "html5"