我有一个django联系表单,我希望当光标在字段中时,找到表单中的初始文本消失。
我的表格现在是:
from django import forms
class ContactForm(forms.Form):
numele_dumneavoastra = forms.CharField(required=True, label="", initial="Numele Dumneavoastra")
numarul_de_telefon = forms.CharField(required=True, label="", initial="Numarul de Telefon ")
# perioada_cand_va_putem_contacta = forms.CharField(required=True)
mesajul_dumneavoastra = forms.CharField(required=True, widget=forms.Textarea, label="", initial="Mesajul Dumneavoastra")
emailul_dumneavoastra = forms.EmailField(required=True, label="", initial="Email")
当用户插入他的名字时,例如“John Doe”我希望最初的文字“Numele Dumneavoastra”从视线中消失。谢谢!
不确定我理解,但也许你应该使用占位符而不是初始。 How do I add a placeholder on a CharField in Django?