You are not logged in.

Change Language:

Freelancer? Consultant? Check out: WorkTrail - Time Tracking made easy
Board » Django » Views » form.is_valid() always returns false

def submit_details(request):
if request.method=='POST':
form=SOFIATMUser(request.POST)
print form.errors
if form.is_valid():
user=SOFIAUserDetails(
UserName='abc',
Name=form.cleaned_data['user_name'],
Phone=form.cleaned_data['user_phone'],
Address=form.cleaned_data['user_address'])
user.save()
return HttpResponseRedirect('/')
return HttpResponseRedirect('Above is the function. form.is_valid() is always returning false.. Can anyone help knowing the error...
hi,
what does:
print "%s" % repr(form.errors)


output?
Sadly it is not giving anything... I tried that too... But it is not showing any error
hmm.. it should at least output an empty array .. or False .. or None ... or at the very least an empty line.
yes.. It is printing an empty line...
Actually I think request.POST dictionary is empty.. Cos i tried to print an element from it, it gives nothing
this is weird.. is your form actually posting? have you tried outputting repr(request.POST) and repr(request.GET)
Ok.. i tried to print request.POST.. and it is showing the dictionary contents... But i am unable to get why is form.is_valid() returning false...
I have my SOFIATMUser a class extending forms.FORM





Powered by Sphene Community Tools