[Fixed]-Javascript function to select option and submit a django form

1👍

Still not sure why the form was not automatically submitting with onchange="this.form.submit();" but I ended up adding a name attribute to my form

<form action="/board/Intuna/" method="post" class="ng-pristine ng-valid" name="filter-form">

And then added to my javascript function

document.filter-form.submit();

and now it works! And to finish it up I wrapped the filterType field with <div class="hidden"> and everything looks/works perfectly!

Leave a comment