hide fields using newforms

1 view
Skip to first unread message

Florian Lindner

unread,
Dec 30, 2007, 11:04:52 AM12/30/07
to Django users
Hello,
using newforms how can I set fields to be hidden (the hidden="hidden"
attribute)?

Thanks,

Florian

l5x

unread,
Dec 30, 2007, 11:11:23 AM12/30/07
to Django users
On Dec 30, 5:04 pm, Florian Lindner <mailingli...@xgm.de> wrote:
> Hello,
> using newforms how can I set fields to be hidden (the hidden="hidden"
> attribute)?

Did you mean type="hidden" ?
http://www.djangoproject.com/documentation/newforms/#widgets

You can create your own widget if you need to.

l.

Todd O'Bryan

unread,
Dec 30, 2007, 4:36:48 PM12/30/07
to django...@googlegroups.com

Or you can just use the HiddenInput widget that already exists. Here's
how you'd declare a hidden text field:

class SomeForm(forms.Form):
my_text = forms.CharField(max_length=20, widget=forms.HiddenInput)

HTH,
Todd

Reply all
Reply to author
Forward
0 new messages