On Wed, Nov 2, 2011 at 12:43 PM, Furbee <Furbeenator@gmail.com> wrote:
I think your 'answer' is going to exist in POST in either case. Perhaps change the construct of your logic to:
if 'evaluation' in request.POST:return render_to_response('results.html')elif 'form-0-answer' in request.POST:
answer = request.POST.get('answer','')
values.append(answer)
return render_to_response('success.html')
FurbeenatorOn Wed, Nov 2, 2011 at 9:21 AM, Kurtis Mullins <kurtis.mullins@gmail.com> wrote:
Try changing your success_url to this same page.On Wed, Nov 2, 2011 at 11:00 AM, asif.jamadar@rezayat.net <asif.jamadar@rezayat.net> wrote:
How can i access the form fields in django views.
Suppose i have modelform called
class QuestionForm(forms.ModelForm):
answer = forms.ChoiceField(choices=HAY_EVALUATION_CHOICES,
widget=forms.Select(attrs={'onchange': 'this.form.submit();'}))
In views.py
if 'form-0-answer' in request.POST:
answer = request.POST.get('answer','')
values.append(answer)
return render_to_response('success.html')
if 'evaluation' in request.POST:
return render_to_response('results.html')
The form consist of one submit button called 'evaluation' and second
is having onchange event on selection
Here i'm trying to perform some operation on selection, then by using
second button that is 'evaluation' i will save the form.
Here the problem is the form is always redirecting to success.html
even when i click 'evaluation' button
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment