Opened 3 years ago

Closed 3 years ago

#19686 closed New feature (fixed)

Support HTML5 number input type

Reported by: claudep Owned by: nobody
Component: Forms Version: master
Severity: Normal Keywords:
Cc: charette.s@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In #16630, we added support for type="email" and type="url" HTML5 input types.

This ticket is about type="number" input type. It has been separated so as we can discuss specific issues, in particular localization issues.

Attachments (1)

ticket-19686-claudep-github-revised.diff (38.5 KB) - added by charettes 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 3 years ago by charettes

  • Cc charette.s@… added
  • Has patch unset
  • Version changed from 1.4 to master

The number input implementation seems to be a bit unstable at the moment.

Chrome implemented it quickly and attempted to localize the input value to the useragent's locale while submitting it the document (or closest parent with a lang attribute) locale. It raised some issues and it's quite hard to work with.

Firefox halted development because many questions arose concerning the decimal mark, group size and separator.

comment:2 Changed 3 years ago by claudep

  • Has patch set

Pull request, with conditional use of NumberInput depending on Field.localize: https://github.com/django/django/pull/696

comment:3 Changed 3 years ago by charettes

  • Patch needs improvement set

Added some concerns at github.

Changed 3 years ago by charettes

comment:4 Changed 3 years ago by charettes

  • Patch needs improvement unset

Attached a version of claudep's patch with additionnal tests and a fix forDecimalField's input "maxlength".

comment:5 Changed 3 years ago by charettes

All tests pass on Python 2.7.3 SQLite3.

comment:6 Changed 3 years ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin

comment:7 Changed 3 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 7ec2a21be15af5b2c7513482c3bcfdd1e12782ed:

Fixed #19686 -- Added HTML5 number input type

Thanks Simon Charette for his help on the patch. Refs #16630.

Note: See TracTickets for help on using tickets.
Back to Top