Currently a form’s default button is defined as follows:
A form element’s default button is the first submit button in tree order whose form owner is that form element.
This is not always practical. For example, consider something like a wizard (ie. a sequence of pages with a form on each) having “Previous” and “Next” buttons. The “Previous” button submits the form in order to temporarily store the values on the current page before returning to the previous page. In order to have the “Next” button be the form’s default button, the “Previous” button must come after it in tree order.
In this rather simple case, maybe the author could get away with putting the “Next” button before the “Previous” button in the source, and then modifying the visual order with CSS and whatever other adaptations are needed/possible (e.g. tabindex), but this can quickly get unwieldy. It also seems wrong to have to base your source order on this criteria in the first place.
One way to address this is to add a boolean attribute “default” to the input element:
<!-- ... -->
<input type="submit" name="previous" value="Previous" />
<input type="submit" name="next" value="Next" default />
The definition of the default button for a form would not need to change much, but simply allow inputs of type “submit” with the “default” attribute present to supercede other submit buttons for default status. In the case that several elements have the attribute, the first in tree order of those elements should be used.
Thoughts on that? Other ways to address the problem?