Django form with label directly in the Field, but disappear on typing -
i achieve same effect google login page label of text field shown in field itself. when characters typed in filed, label automatically disappeared.
i know how achieve similar effect html + java script, like:
<input type="text" name="" id="" value="email" class="gray" onclick="if(this.value=='email') {this.value='';this.classname='black'}" onblur="if(this.value=='') {this.value='email';this.classname='gray'}" />
but django form same effect? know can specify initial
in charfield, won't disappear on typing.
forms.charfield(max_length=100, label=_("email"), initial='xxx')
there html5 prop called placeholdertext. here blogpost how use django forms. django html5 input placeholders excerpt:
class myform(form): name = forms.charfield(widget=forms.textinput({ "placeholder": "joe recruiter" }))
Comments
Post a Comment