Opened 15 years ago
Closed 12 years ago
#13385 closed Bug (duplicate)
Wrong behavior for textarea tag render
Reported by: | William Grzybowski | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.1 |
Severity: | Normal | Keywords: | textarea form |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The Textarea widget is rendering textarea tag like this:
return mark_safe(u'<textarea%s>%s</textarea>' % (flatatt(final_attrs), conditional_escape(force_unicode(value))))
However this is not the expected behavior for textarea tag, as from W3C[1] this should be:
<textarea> first line </textarea>
So the correct render should be:
return mark_safe(u'<textarea%s>\n%s\n</textarea>' % (flatatt(final_attrs), conditional_escape(force_unicode(value))))
[1] http://www.w3.org/TR/html401/interact/forms.html#edef-TEXTAREA
Attachments (4)
Change History (16)
comment:1 by , 15 years ago
Description: | modified (diff) |
---|
comment:2 by , 15 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
I don't see anything in the reference you provide that requires that there be newlines inside the definition of a TEXTAREA, and I haven't seen any evidence that Django's rendering causes problems in any browers in practice.
comment:3 by , 15 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Sorry i forgot to mention.
The problem is like this:
- Write a text using the widget Textarea starting with a newline, like: "\n My text here"
- Save it
- Come back to edit the saved the
You will not see the blank line in the start of the textarea
comment:4 by , 15 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
Ok. I see what you're driving at now. However, it looks to me like only the first \n is required; if you have the trailing \n, you end up padding your submissions.
Tests are also required.
comment:5 by , 15 years ago
OK.
Patch reworked with heading \n.
Tested ok here, tell me if there is anything else to do, i am new here :)
comment:6 by , 15 years ago
FYI, by "tests are also required" Russell meant a regression test for the test suite (i.e. a unit test/doctest). That's what the "needs tests" checkbox on the ticket is for.
comment:7 by , 15 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
comment:8 by , 14 years ago
Textarea tag should be rendered with cols="" and rows="" attributes, because it's needed by W3C validation.
I think it is obligate, event if those attributes are to be set to empty value.
comment:9 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:10 by , 14 years ago
Easy pickings: | unset |
---|---|
Patch needs improvement: | set |
ticket13385.patch fails to apply cleanly on to trunk
comment:11 by , 13 years ago
Patch needs improvement: | unset |
---|---|
UI/UX: | unset |
comment:12 by , 12 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Duplicate of #8627, which has just been fixed.
(reformatted description)