[Answer]-How can i have a text field which have text in it and when the user clicks on the text field the text inside the field vanishes

1👍

You should use attrs parameter for form field widget like this:

from django.forms import TextInput


class CategoriesForm(ModelForm):
    class Meta:
        model = Categories
        widgets = {
            'category_name': TextInput(attrs={'placeholder': 'PLACEHOLDER TEXT HERE'})
        }

Here is documentation

0👍

In your forms.py you can write like this then it will show blur text in text box

first_name = forms.CharField(label=_('First Name'),max_length=30, required=True, widget=forms.TextInput(attrs={'placeholder':'Please Enter Your First Name'})) 

Leave a comment