Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8834947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:08:43+00:00 2026-06-14T09:08:43+00:00

I have a project in which I need to pop a modal window for

  • 0

I have a project in which I need to pop a modal window for not authenticated users.

This modal will allow to login directly or create an account.

So it will contain two forms:

  • django.contrib.auth.forms.AuthenticationForm
  • registration.forms.RegistrationForm

Modal tabbed forms

Here is my view to get both forms:

def ajax_registration(request):
    obj = {
        'login_form': AuthenticationForm(),
        'registration_form': RegistrationForm(),
    }
    return render(request, 'common/ajax_registration.html', obj)

And my template displaying the forms tabbed

<ul class="nav nav-tabs">
  <li><a href="#tab1" data-toggle="tab">{% trans 'Login' %}</a></li>
  <li><a href="#tab2" data-toggle="tab">{% trans 'Registration' %}</a></li>
</ul>
<div class="tab-content">
  <div class="tab-pane active" id="tab1">
    {{ login_form|bootstrap }}
  </div>
  <div class="tab-pane" id="tab2">
    {{ registration_form|bootstrap }}
  </div>
</div>

Question is: Since I’m using ajax to display this modal, How can I validate the selected form, preferably using the already written django-registrations register & django.contrib.auth login views ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:08:44+00:00Added an answer on June 14, 2026 at 9:08 am

    In addition to Maddog’s answer you need some javascript to submit the form back to the URL that rendered the form. Using jquery it could be something like:

    $('form').submit(function(e){
            e.preventDefault();
            var form = $(e.target);
    
            $.ajax({
                url: '{% url YOUR_REGISTRATION_URL %}',
                type: 'post',
                data: account_form.serialize() + '&' + form.serialize(),
                error: function(xhr, ajaxOptions, thrownError){ alert(thrownError); },
                success: function(){}
            })
     })
    

    You don’t need to do it with a form submit element, you could use any element with $().click(), of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project which will need to have some Java layer. I am
I have a project which will need a shopping cart which is where my
I have a project in which I need to display multiple UITableView instances inside
I have a GWT project in which I need to manually specify currency, number
I have a project in which I would need to copy files found within
I have a project which fully designed for smart phone and now, I need
I have recently taken on a project in which I need to integrate with
I have a project in which I need a way to display essentially a
I have a small project for which I need to offer a CMS UI/storage
I have a project which is using DocumentFormat.OpenXml.dll 2.0.3920.0. However, I want this to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.