Changes between Initial Version and Version 9 of Ticket #16304


Ignore:
Timestamp:
Oct 15, 2012, 3:47:26 PM (12 years ago)
Author:
Łukasz Rekucki
Comment:

Is there any reason why this is added only to CharField? placeholder is more of a widget thing, so it shouldn't matter on what type of field I define it as long as I use a widget that can render it. placeholder is also legal on <textarea> not only variations of <input type="...">.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16304

    • Property Needs documentation unset
    • Property Needs tests unset
    • Property Triage Stage UnreviewedAccepted
    • Property Version 1.3SVN
    • Property Summary Forms Need HTML5 'placeholder' attributeAdd HTML5 'placeholder' attribute support to form fields.
    • Property Owner changed from nobody to Kushagra Sinha
    • Property Status newassigned
    • Property Cc Kushagra Sinha Andy Baker added
    • Property Has patch set
    • Property Patch needs improvement set
  • Ticket #16304 – Description

    initial v9  
    33To do this in Django currently, you have to do something like:
    44
     5{{{#!python
    56comment = forms.CharField(max_length=200, widget=forms.TextInput({ "placeholder": "Text!"}))
     7}}}
    68
    79However, to do this with a ModelForm is much more complicated: http://bitkickers.blogspot.com/2010/09/django-html5-input-placeholders.html
     
    911I suggest that there should be an easier way to set placeholder text in form fields and model form fields:
    1012
     13{{{#!python
    1114comment = forms.CharField(max_length=200, placeholder="Text!")
     15}}}
    1216
    1317(This would also be a good starting point for other new HTML5 input elements, such as 'required' and 'email', but those should be separate tickets. The code would be very similar though.)
Back to Top