Skip to content
Advertisement

django: How do i save form in django without the django forms?

I am trying to save a contact form, but i am not using the django form but instead the input field. I am getting the name, email address and message body from the html templates using input field like this <input type="text" id="name"> but the form doesn’t get any data from the input field, it seems i am missing something but i cannot find out what is happening.

I have tried passing in the name, email and message into id="name" id="email" id="message" but nothing still happends.

This is my code index.html

JavaScript

views.py

JavaScript

Advertisement

Answer

This is your form

JavaScript

change to this

JavaScript
  1. add the name=" ... " attribute in your input field and the corresponding values e.g name, email, address.

  2. Change your button type to submit as your would be submiting a form

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement