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 930161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:17:28+00:00 2026-05-15T20:17:28+00:00

User registration in my application is performed in steps. After submitting the form, some

  • 0

User registration in my application is performed in steps. After submitting the form, some validation is performed and then register_prompt view is called. It renders a form, with two options – ‘ok’ and ‘cancel’. Clicking ok will run registration, and clicking cancel should redirect to main page. Problem is that no matter which of the two I choose, I’m redirected to …/user/registration/function_1_or_2_name with a blank page (although I have specified url in HttpResponseRedirect ). How can I make it work ?

def register_prompt(request):
    context = RequestContext(request)
    return render_to_response('user/data_operations/alert.html', context_instance=context)

Form loaded on alert.html :

<form action="" method="post">
    <input type="submit" class="submit" name="submit" onClick="this.form.action='{% url register_new %}'" value="Ok" />
    <input type="submit" class="submit" name="submit" onClick="this.form.action='{% url redirect_home %}'" value="Cancel" />
</form>

Redirect views (maybe there is a better way to do that ?):

def redirect_home(request):
    return HttpResponseRedirect('/')

def register_new(request):
    (... registration magic here ...)
    return HttpResponseRedirect('/user/registration/complete/')

Finally url conf :

   url(r'^register_new/$', register_new, name="register_new"),
   url(r'^redirect_home/$', redirect_home, name="redirect_home"),
   url(r'^register_prompt/$', register_prompt, name="register_prompt"),

At first I was trying to add some abstract values to form’s buttons (like ‘action=ok’), and then catch them in register_prompt but it was a total disaster.

  • 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-05-15T20:17:29+00:00Added an answer on May 15, 2026 at 8:17 pm

    I’m not sure if that onClick="" hack is really valid (I’ll let someone else weigh in on that), but did you try just using normal links, to see if it’s that or something else?

    <a href="{% url register_new %}">OK</a>
    <a href="{% url register_home %}">Cancel</a>
    

    (Or check out <button> if you really want it to look like buttons. Or just use two <form>s, each with a separate action="" attributes.)

    Hum, other than that… You say “…/user/registration/function_1_or_2_name” — what exactly does the {% url .. %}s give you? Does it not add the final / (which you require in your patterns)?

    At first I was trying to add some
    abstract values to form’s buttons
    (like ‘action=ok’), and then catch
    them in register_prompt but it was a
    total disaster.

    But you seem to want to manipulate the action attribute, so you can’t catch anything in register_prompt()?

    All in all I’d suggest you either use normal links, or actually handle the POST in the view that presented it:

    def register_prompt(req):
        if 'ok' in req.POST:
            return register_new(req)
        if 'cancel' in req.POST:
            return register_cancel(req)
        return render_to_response('user/data_operations/alert.html',
                                  context_instance=RequestContext(req))
    

    Maybe something like that? Renaming your buttons to ok and cancel, and having the form post back to itself…

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

Sidebar

Related Questions

In my web application i have registration form, when user register i want to
I'd like to create a user registration form where the user ticks some boxes
This is my application's current workflow for user registration. register form ( GET /register
I have a user registration form in my Django application which collects additional data
I have a Unity3D application who needs registration. The user needs to register in
I have a user registration Form. If a new User register their account in
I am creating an user registration form using jsp,in which there is an option
I have to do a user registration form (classical layout with two columns, labels
I want to create a simple user registration form with First / Last name,
Let's say I have an user registration form. In this form, I have the

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.