ok so have this snippet of code -
if 'myform' in request.POST: '''handle the form submition''' return True return False
this returns false. any ideas why?
Are there any input fields in this form? You should be checking for that rather than the name of the form. The form itself is nothing, so what data is being posted? i.e. a text input field named someData.
if 'someData' in request.POST:
here is the solution i used to solve my problem - (thank you very much fosco and adam!)
<form id="my_form" action="." method="post"> <a href="#" onclick="document.forms['my_form'].submit();">Call Form</a> <input type="checkbox" name="call_form" checked style="visibility:hidden"><br> <input type="submit" value="create form" style="visibility:hidden" /> </form>`
I assume "using an href" means you click a link programatically? Links always send GET requests so that's why it fails. You can submit the entire form with JS using
document.forms.myform.submit(); and that will send it with POST since that's the method you specified in the form.
©2020 All rights reserved.