[Answer]-Forms.hiddenInput not working

2👍

You want to change your for loop like this

{% for field in form.visible_fields %}

to iterate only over the visible fields. See this link for reference.

Also, to check if the field is hidden, you must use is_hidden:

{% if field.is_hidden %}
   {# Do something special #}
{% endif %}

You confused a hidden field (actually available in your templates but not visible) with a model field not being sent at all (achievable using the exclude parameter in your form’s metaclass). Iterating over the fields of a form will show all (visible and hidden) except those in the exclude list.

-1👍

With the forms.HiddenInput() it’s going to be hard to get something show up!
I suggest you to use django password forms:

'account': forms.RegexField(label ="Password",regex=r'^(?=.*\W+).*$',help_text='',
                    widget=forms.PasswordInput,min_length=6,)

Leave a comment