8👍
✅
You can add a placeholder attribute to your email_param field. So your forms.py would be:
from django import forms
class ContactForm(forms.Form):
name_param = forms.CharField()
email_param = forms.EmailField(widget=forms.EmailInput({'placeholder': 'test@example.com'}))
message_param = forms.CharField(widget=forms.Textarea)
recaptcha_param = ReCaptchaField()
👤Oli
1👍
That’s just HTML
<input type="email" placeholder="This is used to contact you..." name="email"/>
- [Django]-How to do related questions autopopulate
- [Django]-How to truncate content for Mdeditor (content as markdownx) – Django
- [Django]-ImportError: cannot import name connections
1👍
Just notice that the
forms.EmailField()
does not take as argument a widget.
The way you could do that could be
models.EmailField(max_length=255,default=’you default value or example@email.com’)
That is more robust that the html solution, as give you the way to manage that on the Database
Source:stackexchange.com