72371

Form not Posting in Django

I'm trying to do some pretty basic form posts with Django, but whenever I try to click on the button to submit the information nothing happens. No errors or messages of any kind show up in terminal or in developer in Chrome. There is no JS on this page just straight html:

<form method="post" action="/"> {% csrf_token %} <input type="text" id="name" name="name"/> <input type="text" id="password" name="password"/> <input type="button" value="Sign Up!"/> </form>

My view for this page is pretty straightforward as well:

def sign_up(request): return render_to_response('portal/signup.html', context_instance=RequestContext(request))

I'm really baffled as to what is going on, I've been following this to learn authentication. Everything works but I thought adding a "create user" would be a next step. I can't seem to get any form of any kind to work on other pages as well.

Any help would be great, I'm going crazy!

Answer1:

I think that your problem is that you're using

<input type="button" value="Sign Up!"/>

instead of

<input type="submit" value="Sign Up!"/>

the input submit will send all the form data to the server, the input button won't. You can learn a little bit more about forms here : http://www.w3schools.com/html/html_forms.asp

Recommend

  • Singular Value Decomposition Implementation
  • Enterprise Architect - Cancel Connectors Bridges
  • Why the SequenceFile is truncated?
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • Implementing “partial void” in VB
  • Sending HTML Form Data to Spring REST Web Service
  • Authentication in Play! and RestEasy
  • MongoError: Incorrect arguments
  • Atlas images wrong size on iPad iOS 9
  • Django rest serializer Breaks when data exists
  • Spring security and special characters
  • Trying to switch camera back to front but getting exception
  • htaccess rewriting URLs with multiple forward slashes
  • what is the difference between the asp.net mvc application and asp.net web application
  • Display Images one by one with next and previous functionality
  • Web-crawler for facebook in python
  • How to get icons for entities from eclipse?
  • A cron job substitute?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • Memory offsets in inline assembly
  • How to stop GridView from loading again when I press back button?
  • Turn off referential integrity in Derby? is it possible?
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Authorize attributes not working in MVC 4
  • JaxB to read class hierarchy
  • Programmatically clearing map cache
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize