Button doesn't work upon incorporating bootstrap table

Viewed 46

After spending days agonizing over this error and looking for someone who might have had this same problem, I'm finally ready to just ask the question myself. I'm building an app on Django. My post button worked perfectly, but upon incorporating bootstrap-table, it doesn't work anymore. And by doesn't work anymore, it seems to have gone completely dormant -- no error logged in the console or terminal, it just looks like a button, but does absolutely nothing. Has anyone encountered a similar issue to this, and how did you fix it?

If I take out data-toggle="table" in the table tag, the button works... but it completely messes up the styling, and I'd like to avoid that.

A solution I thought might work would be to manually link the button to the view, but I'm still somewhat of a django noob, and don't know how to do that. Would appreciate any help!

Here is my template html:

<table
            id="table"
            data-toggle="table"
            data-search="true"
            data-height="650"
            data-show-columns="true">
            <thead>
                <tr>
                <th data-sortable="true">ID</th>
                </tr>
            </thead>
            <tbody>
                {% if df %}
                {% for i in df %}
                    <tr>
                    <form method="POST">
                    {%csrf_token%}
                    <td value="{{i.ID}}"><input value="{{i.ID}}" name="dataId" type="text" class="form-control" aria-label="Large" aria-describedby="inputGroup-sizing-sm"></td>
                    <td>
                        <form method="POST">
                           <button type="submit" class="btn btn-secondary" name="updatePlacement">Save</button>
                        </form>
                    </td>
                </form>
                    </tr>
                {% endfor %}
                {% endif %}
                </tbody>
        </table>

and part of my view:

def post(self, request):
     if "updatePlacement" in request.POST:
         print('hi')
         return render(request, "placement/index.html")
0 Answers
Related