#28303 closed Bug (fixed)
IntegerField & NumberInput widget localize max_value when rendering form field
Reported by: | Richard Owen | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.11 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This issue is a change / regression in Django 1.11. It works correctly with Django 1.10. Tested on Django 1.11.2 and Python 2.7.13.
Reproduction Steps
- Enable the following settings:
USE_L10N = True USE_THOUSAND_SEPARATOR = True
- Create a form with an IntegerField with a large max_value set:
class TestForm(forms.Form): integer_field = forms.IntegerField(max_value=999999)
Expected Result
Form is rendered as
<input type="number" name="integer_field" max="999999" required id="id_integer_field" />
Actual Result
Form is rendered as
<input type="number" name="integer_field" max="999,999" required id="id_integer_field" />
Note the comma separator in the max attribute on the input.
Internet Explorer 11 treats this field as having a max attribute of 999. So entering a value of 1000 in the field prevents the user from submitting the form.
Change History (4)
comment:1 by , 7 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
581879a510e58841e5780a5d1fdb4995733d2036 fixed a similar issue and might be a useful template for developing a patch.