Log in
Assorted digital displays showing
numbers in different colours,
format and pixellation
2011-03-07 13:35

Example 2: Specification: Repeated rows

This example from the original specification “shows how to use repetition templates to dynamically add rows to a form in a table”:

Initially, two rows would be visible, each with two text input controls, the first row having the values "John Smith" and "2", the second row having the values "" (a blank text field) and "1". The second row is the result of the (implied) repeat-start attribute adding a repetition block when the document was loaded.

If the "Add Row" button is pressed, a new row is added. The first such row would have the index 2 (since there are already two repetition blocks numbered 0 and 1) and so the controls would be named "name_2" and "count_2" respectively.

If the "Delete Row" button above is pressed, the row is removed.

The form data are sent to <https://software.hixie.ch/utilities/cgi/test-tools/echo> to assist in analysing the submitted HTTP request.

Name Number of Cats

↑ Menu
Previous edition ↓