Skip to content

Commit 3a86da6

Browse files
committed
Fix "form.submit is not a function" error
If a form has an input named `submit` it will overwrite the forms submit function with a reference to the element. Calling it right from the class and passing the instance fixes this issue.
1 parent bd9485d commit 3a86da6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

s3file/static/s3file/js/s3file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
waitForAllFiles(form)
2323
}, 100)
2424
} else {
25-
form.submit()
25+
HTMLFormElement.prototype.submit.call(form)
2626
}
2727
}
2828

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name='django-s3file',
6-
version='3.0.1',
6+
version='3.0.2',
77
description='A lightweight file uploader input for Django and Amazon S3',
88
author='codingjoe',
99
url='https://github.com/codingjoe/django-s3file',

tests/testapp/templates/form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<form method="post">
1414
{% csrf_token %}
1515
{{ form }}
16-
<input type="submit" value="Submit Form"/>
16+
<input type="submit" name="submit" value="Submit Form"/>
1717
</form>
1818
{{ form.media.js }}
1919
</body>

0 commit comments

Comments
 (0)