About the Form Attribute

Use the form attribute to attach input fields to a specific form. This is especially useful when working with tabular data, where different cells can have common or individual form actions, for example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<form id="export_form" action="" method="post">
  <button type="submit" 
   name="action" value="export">Export</button>
</form>

<table>
  <tr>
    <td>
      <input name="id" type="checkbox" value="1"
       form="export_form" />
    </td>
    <td>Django Blog Tutorial</td>
    <td>
      <form action="" method="post">
        <input type="hidden" name="id" value="1" />
        <button type="submit" 
         name="action" value="delete">Delete</button>
      </form>
    </td>
  </tr>
  <tr>
    <td>
      <input name="id" type="checkbox" value="2"
       form="export_form" />
    </td>
    <td>Django Chat Tutorial</td>
    <td>
      <form action="" method="post">
        <input type="hidden" name="id" value="2" />
        <button type="submit" 
         name="action" value="delete">Delete</button>
      </form>
    </td>
  </tr>
</table>

Tips and Tricks Development HTML5