Include Submit button automatically?
See original GitHub issueHey guys,
I made a template for an existing package with this Django code:
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Sign Up" class="btn btn-primary">
</form>
I’d like to use bootstrap templating of Crispy forms, but when I do this
<form method="POST">
{% crispy form %}
<input type="submit" value="Sign Up" class="btn btn-primary">
</form>
Crispy forms renders the submit button outside the form tags and the form is useless:
<form method="POST">
<input type="hidden" name="csrfmiddlewaretoken" value="...">...
<input ... name="first_name" type="text"> ...
<input ... name="last_name" type="text">...
<input ... name="email" type="email">...
<input ... name="password1" type="password">
</form>
<input type="submit" value="Sign Up" class="btn btn-primary">
Do I miss a feature of Crispy forms? How do you solve this without writing a custom form for the 3rd party package. Thanks in advance.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
Disable form auto submit on button click - Stack Overflow
Buttons like <button>Click to do something</button> are submit buttons. Set type="button" to change that. type="submit" is the default (as specified by the ...
Read more >Automatically execute the "Submit" button - CodeProject
"Automatically execute" means: sending an HTTP request with the URL defined by the URL written as a value of the attribute action and, ......
Read more ><input type="submit"> - HTML: HyperText Markup Language
An <input type="submit"> element's value attribute contains a string which is displayed as the button's label. Buttons do not have a true ...
Read more >How to auto submit form without using Submit button? - Jotform
You would need to insert javascript code with full source code of your form to your webpage. This way your embedded form B...
Read more >HTML Form – Input Type and Submit Button Example
You use this type to add a submit button to forms. When a user clicks it, it automatically submits the form. It takes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
crispy
tag takes aFormHelper
as an optional second argument. If you setform_tag = False
on that helper (I think) you should get what you want.Review
crispy
tag docs — there are a lot of examples there.(I’m guessing you’re getting two
form
elements rendered — the one in your template plus the one fromcrispy
. Either remove you own ones and add aSubmit
element to the helper or disable the helper’sform_tag
)Thanks, guys. I created a generic Form with just one FormHelper which disables the form_tag like @carltongibson suggested. The power of the crispy forms tag shouldn’t be underestimated 😉