ninjakx
ninjakx

Reputation: 35

How to wrap a input button by form tag?

So the following tables are generated from backend where I load CSV and used pandas.style to make some column as an input text field and a button. I applied the same function on all of the value of the column but the thing is all the column 1 has the form tag except the one that is row 0 element. You can see from the below table. When I do view page source I am able to see the form tag on the first row also but inspect elem doesn't show it. So one thing I can think of is to use javascript and add form tag but I don't know how to do it.

<table id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2" >
<thead>
    <tr>
        <th class="blank level0" ></th>
        <th class="col_heading level0 col0" >x</th>
        <th class="col_heading level0 col1" >y</th>
        <th class="col_heading level0 col2" >z</th>
        <th class="col_heading level0 col3" >s</th>
        <th class="col_heading level0 col4" >t</th>
    </tr>
</thead>
<tbody>
    <tr>
        <th id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2level0_row0" class="row_heading level0 row0" >0</th>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row0_col0" class="data row0 col0" >123</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row0_col1" class="data row0 col1" ><input name="id_request" type="submit" value="hab123" /></td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row0_col2" class="data row0 col2" >0</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row0_col3" class="data row0 col3" >0.0254823</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row0_col4" class="data row0 col4" ><input name="prob" type="number" step="0.01" min="0" max="1" value="0.25" /></td>
    </tr>
    <tr>
        <th id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2level0_row1" class="row_heading level0 row1" >1</th>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row1_col0" class="data row1 col0" >145</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row1_col1" class="data row1 col1" >
            <form method="POST" ><input name="id_request" type="submit" value="hab234" /></form>
        </td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row1_col2" class="data row1 col2" >0</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row1_col3" class="data row1 col3" >0.0160481</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row1_col4" class="data row1 col4" ><input name="prob" type="number" step="0.01" min="0" max="1" value="0.0" /></td>
    </tr>
    <tr>
        <th id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2level0_row2" class="row_heading level0 row2" >2</th>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row2_col0" class="data row2 col0" >567</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row2_col1" class="data row2 col1" >
            <form method="POST" ><input name="id_request" type="submit" value="hab056" /></form>
        </td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row2_col2" class="data row2 col2" >0</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row2_col3" class="data row2 col3" >0.0297317</td>
        <td id="T_8ee5b050_16c9_11ea_97a1_9d9fe3c434b2row2_col4" class="data row2 col4" ><input name="prob" type="number" step="0.01" min="0" max="1" value="0.5" /></td>
    </tr>
</tbody>
</table>

Upvotes: 1

Views: 49

Answers (1)

Wassel
Wassel

Reputation: 118

To create an element in Javascript, you must use document.createElement (so, here, document.createElement("form")). However, I just do not understand why your form doesn't appear. See if it is not linked with the fact that the 2 inputs have the same name.

Upvotes: 1

Related Questions