Skip to content

[Form] Add input step attribute if with_seconds enabled #9976

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

Closed
wants to merge 3 commits into from
Closed

[Form] Add input step attribute if with_seconds enabled #9976

wants to merge 3 commits into from

Conversation

konandrum
Copy link

No description provided.

@hacfi
Copy link
Contributor

hacfi commented Jan 11, 2014

@idciconsulting Won’t this make it impossible to overwrite step with the form options attr property?

@konandrum
Copy link
Author

Great idea, I suggest two possibilities:

  • first change the with_seconds parameter type from boolean to an integer for exemple, and use the given value as the step (or rename this field because with_... sound to be a boolean).
  • second add a new parameter call step for exemple, and use it if the with_second is 'true'. (But if this value is set to 0 this could became the with_seconds parameter useless)

Your opinion ?

@fabpot
Copy link
Member

fabpot commented May 16, 2014

Closing in favor of #10777

@fabpot fabpot closed this May 16, 2014
fabpot added a commit that referenced this pull request May 16, 2014
…ets to display seconds if needed (tucksaun)

This PR was squashed before being merged into the 2.3 branch (closes #10777).

Discussion
----------

[Form] Automatically add step attribute to HTML5 time widgets to display seconds if needed

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

Same issue as #9976 and #10203: when you add a `time` field to a form with options `single_text` (so HTML5) and `with_seconds`, the generated input does not contain the `step` attribute, therefore the browser does not show them, leading to an error at the submit because of an invalid format.

Compared to #9976/#10203:
* Unit testable
* Available directly in the component
* Available in other templating format than twig
* Still able to customise the step attribute by hand

Commits
-------

a379298 [Form] Automatically add step attribute to HTML5 time widgets to display seconds if needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants