Re: Customizing Form Field HTML Attributes
Thank you. Stuart MacKay wrote: > > Take a look at the widgets used to display a form. From the > documentation: https://docs.djangoproject.com/en/dev/ref/forms/widgets/ > > "On a real Web page, you probably don't want every widget to look the > same. You might want a larger input element for the comment, and you > might want the 'name' widget to have some special CSS class. To do this, > you use the Widget.attrs argument when creating the widget: > > For example: > > class CommentForm(forms.Form): > name = forms.CharField( > widget=forms.TextInput(attrs={'class':'special'})) > url = forms.URLField() > comment = forms.CharField( >widget=forms.TextInput(attrs={'size':'40'}))" > > Regards, > > Stuart MacKay > Lisbon, Portugal > > >> >> I would like to use the 'title' attribute of several form fields to hold >> our >> help_text, rather than displaying the text alongside the field. I don't >> see >> any way, though, to add or modify tag attributes on a form field. How >> would >> I do this? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > -- View this message in context: http://old.nabble.com/Customizing-Form-Field-HTML-Attributes-tp32164210p32164300.html Sent from the django-users mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Customizing Form Field HTML Attributes
Take a look at the widgets used to display a form. From the documentation: https://docs.djangoproject.com/en/dev/ref/forms/widgets/ "On a real Web page, you probably don't want every widget to look the same. You might want a larger input element for the comment, and you might want the 'name' widget to have some special CSS class. To do this, you use the Widget.attrs argument when creating the widget: For example: class CommentForm(forms.Form): name = forms.CharField( widget=forms.TextInput(attrs={'class':'special'})) url = forms.URLField() comment = forms.CharField( widget=forms.TextInput(attrs={'size':'40'}))" Regards, Stuart MacKay Lisbon, Portugal > > I would like to use the 'title' attribute of several form fields to hold our > help_text, rather than displaying the text alongside the field. I don't see > any way, though, to add or modify tag attributes on a form field. How would > I do this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Customizing Form Field HTML Attributes
I would like to use the 'title' attribute of several form fields to hold our help_text, rather than displaying the text alongside the field. I don't see any way, though, to add or modify tag attributes on a form field. How would I do this? -- View this message in context: http://old.nabble.com/Customizing-Form-Field-HTML-Attributes-tp32164210p32164210.html Sent from the django-users mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.