Hello, I'm trying to create a form. Here is my form class:
class RegisterForm(forms.Form):
login=forms.CharField(min_length=5,max_length=15)
password=forms.CharField(min_length=5,max_length=15,widget=forms.PasswordInput)
passwordConfirmation=forms.CharField(min_length=5,max_length=15,label="Re enter password",widget=forms.PasswordInput)
email=forms.EmailField(min_length=5,max_length=20)
question=forms.CharField(min_length=8,max_length=20,label="Security question")
answer=forms.CharField(min_length=5,max_length=20,widget=forms.PasswordInput)
answerConfirmation=forms.CharField(min_length=5,max_length=20,label="Re enter answer",widget=forms.PasswordInput)'
And now i have tamplate as follow:
{% if form.login.errors %}
{{ form.login.errors }}
{% endif %}
{{ form.login }}<label for="login">Enter desired login</label><br />
And so on i just only change form.name etc. to one from the forms class. And when i filled form incorrect i don't get any error or nothing just blank form. Where I made a mistake? Thx for help Edit: Sorry i forget to show my function here is it
def register(request):
if request.method == 'POST':
form=RegisterForm(request.POST)
if form.is_valid():
return HttpResponseRedirect('/thanks/register')
else:
form = RegisterForm(auto_id=False)
return render_to_response('misc/register.html',locals(),context_instance=RequestContext(request))
else:
form=RegisterForm(auto_id=False)
return render_to_response('misc/register.html',locals(),context_instance=RequestContext(request))