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

Dave Land land at aol.com
Fri Mar 27 09:13:58 CDT 2009


Jay,

Easier still is to set the form's action attribute to javascript that  
will trigger your ajax goodness.

Dummy non-Ajaxian example:

<form name="test" method="post"
action="javascript:alert(document.test.field.value)">
    <input type="text" name="field">
</form>

Filling in the "field" and hitting return displays your field's value  
in an alert.

Of course, this code is not guaranteed to work on anything but my  
personal copy of Camino, for which I will take a lap.

Dave

On Mar 25, 2009, at 3:06 PM, Jay Turley wrote:

> Okay, so I know we've all had those moments where you ask the
> question, and then you know the answer just a second after you finish.
> Well, this was one of those.
>
> I simply added onsubmit="javascript:return false;" to the form tag
>
> This worked, but it still seems kind of stinky. :/
>
> And so:
>
> [tip type="jQuery open new window"]
> You can use the following line of jQuery to convert all anchor links
> with a rel attribute of "external" into links which pop open content
> into a new window.
>
> $('a[rel=external]').attr('target','_blank');
>
> Of course, the question of "if you should" is an entirely different  
> one.
> [/tip]
>
> On Wed, Mar 25, 2009 at 2:41 PM, Jay Turley <jayturley at gmail.com>  
> wrote:
>> Hi all-
>>
>> The HTML spec (
>> http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2 ) says:
>>
>> When there is only one single-line text input field in a form, the
>> user agent should accept Enter in that field as a request to submit
>> the form.
>>
>> 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.
>>
>> The site does NOT need to be accessable and any javascripted  
>> solutions
>> do NOT need to be degradable or enhance progressively.
>>
>> Any thoughts on how to stop this behavior?
>>
>> Thanks!
>>
>> -Jay
>>
> -- 
>
> * * 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