django表单和标题属性 [英] django form and title property

查看:52
本文介绍了django表单和标题属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用"title"属性呈现表单以进行jquery验证,以这种方式呈现表单的情况有多糟糕?

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" />

谢谢大家

推荐答案

最简单的方法是手动设置此属性,并设置为静态,如下所示:

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'} ))

这篇关于django表单和标题属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆