[wp-hackers] how about <form action="">?

Otto otto at ottodestruct.com
Wed Feb 4 14:04:34 GMT 2009


On Wed, Feb 4, 2009 at 6:16 AM, mrmist <listswphackers at mist.org.uk> wrote:
> In message <8763jrnd9i.fsf_-_ at jidanni.org>, jidanni at jidanni.org writes
>> Gentlemen, I notice several places where the code makes <form
>> action="..."> URIs where the result would just be the default URI anyway.
>> Perhaps one could just get away with <form action=""> in those cases?
>
> Personally I find empty actions disturbing.  I know it might be valid and
> all that, but it just looks wrong.

I find your lack of faith disturbing. ;-)

Empty actions are perfectly valid. They're recommended for a lot of
cases. I use them all the time. Actually, the "action" is just defined
as a URI reference, however an empty-URI is defined to point to the
current page. From RFC 2396:

4.2. Same-document References

   A URI reference that does not contain a URI is a reference to the
   current document.  In other words, an empty URI reference within a
   document is interpreted as a reference to the start of that document,
   and a reference containing only a fragment identifier is a reference
   to the identified fragment of that document.  Traversal of such a
   reference should not result in an additional retrieval action.
   However, if the URI reference occurs in a context that is always
   intended to result in a new request, as in the case of HTML's FORM
   element, then an empty URI reference represents the base URI of the
   current document and should be replaced by that URI when transformed
   into a request.


More information about the wp-hackers mailing list