[Bug 13320] New: New Feature: Define a default form submit behavior. Currently, there is no specified behavior that I am aware of for browsers when the 'enter' key is pressed in a text input field inside a form. Some browsers submit using the form with no button value.

http://www.w3.org/Bugs/Public/show_bug.cgi?id=13320

           Summary: New Feature: Define a default form submit behavior.
                    Currently, there is no specified behavior that I am
                    aware of for browsers when the 'enter' key is pressed
                    in a text input field inside a form.  Some browsers
                    submit using the form with no button value.
           Product: HTML WG
           Version: unspecified
          Platform: Other
               URL: http://www.whatwg.org/specs/web-apps/current-work/#top
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P3
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: contributor@whatwg.org
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


Specification: http://www.w3.org/TR/html5/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
New Feature: Define a default form submit behavior.

Currently, there is no specified behavior that I am aware of for browsers when
the 'enter' key is pressed in a text input field inside a form.  Some browsers
submit using the form with no button value.  Some browsers submit using the
first submit button found in the form.    As web app developers, it would be
helpful to be able to declaratively define that behavior, even on a per input
basis.

Consider a large form with a paging form control.  The paging control allows
the user to move back and forth between sections of the form. 

At the beginning of the form, there's a 'save' button. Following that are some
form fields.  At the bottom of the form there's also one text input to update
the current page number. On either side of the field, there are 'back' and
'forward' buttons to increment/decrement the page number one page at a time.

You can see the problem now.  If I change any form input field and press
enter, in some browsers, the value of the save button is submitted as well. 
If I am in the fields before the paging control, this may be the desired
behavior.  If I am just changing the page number, it is most likely not the
desired behavior.  

If I break the paging into a separate form, some browsers will still submit
the 'back' form button when updating the page number, and all the values the
user may have entered into the now separate main form will be lost.

Since forms are central to any web app, web developers have been required for
years to create javascript 'solutions' which simply don't work when scripting
is disabled. There needs to be a declarative way to assign a default button to
a particular input field and a clearly defined behavior for cases where forms
are submitted and no default button is assigned.

Thank you.

Posted from: 65.121.92.28
User agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us)
AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 21 July 2011 18:25:39 UTC