[thelist] Forms with single text inputs and HTML spec - Help?

Jay Turley jayturley at gmail.com
Fri Mar 27 17:32:26 CDT 2009


First of all I want to point out that my specific problem was that in
the special case of a sole single text input in a form, the HTML spec
says that the form should be submitted when ENTER is pressed, EVEN IF
THE FORM HAS NO ACTION SPECIFIED.

Since I was writing AJAX-only forms (app is non-degradable and
non-accessable, so no worries about standards and progressive
enhancement), my forms had no action specified, and no submit inputs,
only buttons, which are triggers for the AJAX calls.

So, to answer YOUR question, Sarah, the POST submission was done
through jQuery's ajax() method.

There turned out to be several ways to stop the specced submission,
but onsubmit="return false;" in the form tag was the simplest, and
since I don't need to worry about validation in this case, I didn't
have to try to progressively enhance the form with
event.preventDefault() or something like that.

Hope that makes it all clear and thanks to everyone for the thoughts
and discussion.

-Jay

On Thu, Mar 26, 2009 at 7:07 AM, Sarah Adams <sarahwbs at gmail.com> wrote:
>>> I'm trying to do an AJAX form submission  of a form with "only one
>>> single-line text input field" and no matter what I do, when I hit the
>>> ENTER button in major browsers, the form is submitted as a GET request
>>> with a query string.
>
>> I simply added onsubmit="javascript:return false;" to the form tag
>>
>> This worked, but it still seems kind of stinky. :/
>
> How did this make your form submit as POST instead of GET?
>
> --
> sarah adams
> my son: http://clarkeadams.com
> twitter: http://twitter.com/sarahwbs
> portfolio: http://sarah.designshift.com
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list