Hi Karen,

In one of my HTML page I have included 2 forms, where both the forms
have required=True fields and have submit buttons respectively.
The problem is when a user submits one form (by clicking one of submit
button form the page)  and if at all it has some errors (as validated
in clean method of forms)
I want to populate errors only from the submitted form.

I am rendering the page in the following way in my views.py

def login(request, redirect_field_name=REDIRECT_FIELD_NAME):
   if request.method == "POST":
        form1 = loginForm(request.POST)
        form2 = SearchForm(request.POST)
        form1_hidden = request.POST.get('hiddenForm1')
        form2_hidden = request.POST.get('hiddenForm2')

        if form1.is_valid() and form1_hidden == 'True':
        return render_to_response("homepage.html")
        if form2.is_valid() and form2_hidden == 'True':
        return render_to_response("searchresults.html")
    else:
        form1 = loginForm()
        form2 = SearchForm()
return render_to_response("login.html", {
        "form1": form1,
        "form2": form2,
        })

Now in a case where form1 has errors,  I want to render the both the
forms  with the errors of  form1 only.

Request you to let me know a solution for the above problem.

Thanks for your patience.

Regards,
Lokesh
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to