Home > OS >  Bootstrap not allows to post data from html in django
Bootstrap not allows to post data from html in django

Time:01-11

{% csrf_token %} User name
    </div>
    <div >
        <label  for="form2Example2">Password</label>
        <input type="password" id="form2Example2"  name="password" required/>

    </div>

    <button type="button" >Sign in</button>
    

i try to post data like email id and password in post method , but it sent through get method . I think there may be problem with bootstrap. can u tell me what are the modifications to be done in the bootstrap for post data method.

thanks

CodePudding user response:

If you want to send it as post, then use button type: "submit". Also you might need form section, if you don't have it. Like this:

<form method="POST">
    {% csrf_token %}
    <div >
        (...)
    </div>
    <button type="submit" >Sign in</button>
</form>

CodePudding user response:

You need to add method = "POST" with {% csrf_token %} and submit button

<form method="POST">
    {% csrf_token %}
    <div >
      <label>Email address</label>
      <input type="email" >
    </div>
    <div >
      <label>Password</label>
      <input type="password" >
    </div>

    <button type="submit" >Signin</button>
  </form>

  • Related