Let’s say we accept a acquaintance anatomy and we appetite to add placeholders to this anatomy inputs so our rendered anatomy has these air-conditioned ascribe labels. How do we do that?
My anatomy is a adolescent of ContactForm chic provided by django_contact_form bore (https://github.com/ubernostrum/django-contact-form). The bore defines absence fields for that form: name, email and message. We charge to add a placeholder aspect in our anatomy chic constructor.
In adjustment to adapt acreage accoutrement attributes we charge to use the afterward cipher template
where field_name is a name of our acreage (email, for example), attribute_name is a name of our aspect (in our case it’s placeholder) and attribute_value is a amount we appetite aspect to accept (in our archetype it’s a label).
Here’s the result:
Now you can cede the anatomy in a arrangement and you’ll see that inputs now accept placeholders.
Hope this one was helpful. Till aing time.
This column was originally acquaint on my blog: http://timonweb.com/posts/override-field-widget-attributes-in-a-django-form-or-how-to-add-placeholder-attribute-to-django-form-input/
11 Reasons You Should Fall In Love With How Do I Add A Form To My Website | How Do I Add A Form To My Website – how do i add a form to my website
| Encouraged to help my blog, on this moment I’ll provide you with concerning how do i add a form to my website