django form and title property

孤人 提交于 2020-04-13 06:14:59

问题


i need to render my forms with the property "title" for jquery validation, how ill render my forms in this way?

<input name="name" id="name" title="Please fill Your name!" value="" type="text" />

Thanks guys


回答1:


Simplest way is to set this attribute manually and static like this:

class MyForm(forms.Form):
myfield = forms.CharField(widget=forms.TextInput(attrs={'title':"MYMEGATITLE","id":"MY_ID",'size':'60','maxlength':'70'} ))


来源:https://stackoverflow.com/questions/2884382/django-form-and-title-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!