Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Form Template Button

Tags:

django

Django accepts and works with form button in format:

<input type="submit" value="Submit" />

How to make it to work with the following:

<button type="button">Submit</button>
like image 758
bobsr Avatar asked Mar 01 '26 15:03

bobsr


2 Answers

Could you explain what exactly you mean by "Django accepts and works with form button in format"? As far as I know the difference in the behaviour of <input type="submit" .../> and <button type="button">... has nothing to do with Django. Django does not care how a form is submitted from the browser.

This previously posted question might be of interest.

like image 159
Manoj Govindan Avatar answered Mar 04 '26 04:03

Manoj Govindan


Add the following to the button to submit the form: ("myform" is the id of your form)

onClick="javascript.document.myform.submit();"

like image 41
dannyroa Avatar answered Mar 04 '26 04:03

dannyroa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!