I have a screen which displays just fine the first time in, however when I knowingly submit the page without entering data in all of the fields to cause an error the page loses some of the data and controls. I'm sure my view code is probably missing something just not sure at this point what exactly is missing. So far my view is coded according to the example given in the document at http://docs.djangoprojects.com/en/1.2/topics/forms/. The example though does not seem to clearly indicate what should be sent back to the screen in the case of errors. Below is my addchoice view which is the one in question:
def addchoice(request): message = "" pollcount = Poll.objects.all().count() if pollcount > 0 : message = "Number of polls passed to form was " + str(pollcount) else: message = "No polls passed in to form." dctnry = {} if request.method == "POST": form = AddChoiceForm(request.POST) if form.is_valid(): poll = form.cleaned_data['pollquestions'] slctdchoice = form.cleaned_data['newchoice'] if isinstance(poll.id, int): newchoice = Choice(poll=poll.id, choice=slctdchoice, votes=0) newchoice.save() confirmmessage = "Choice: " + slctdchoice + " : has been save for poll: " + str(pollid) + "." dctnry = { 'form': form, 'infomessage': message, 'confirmmessage': confirmmessage } else: form = AddChoiceForm() dctnry = { 'form': form, 'infomessage': message } return render_to_response('polls/addchoice.html', dctnry, context_instance=RequestContext(request)) I would appreciate any suggestions for how to correc the code or links to one or more complete screen error processing view code. Thanks for the help. -- 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.