[whatwg] HTML5 and URI Templates

If a legacy browser comes across <form template="..." />, it would be no
different than if it came across a form element with no action
attribute; which means it would have the same impact as the html5 choice
to allow the accept attribute.

It should be possible for us to also do something like:

  <form action="http://example.org/form_processor"
        template="http://example.org?{-join|&|a,b}"
        method="POST">
    <input name="a" type="text" />
    <input name="b" type="text" />
    <input name="c" type="text" />
    <input name="d" type="text" />
  </form>

In a template-aware HTML5 processor, when the form is submitted, the
value of the action attribute would be overridden by the expanded URI
Template. In legacy browsers, however, the form will be posted to
http://example.org/form_processor.  This would provide application
developers with a simple and hopefully transparent fallback for
down-level browsers.

HTML5 Post:

  POST /example.org?a=w&b=x
  Host: example.org
  ...
  c=y&d=z

HTML4 Post:

  POST /form_processor
  Host: example.org
  ...
  a=w&b=x&c=y&d=z

- James

Henri Sivonen wrote:
> On Dec 16, 2007, at 05:28, James M Snell wrote:
> 
>> The gist of the idea (which I believe may have been brought up before
>> but I'm not certain) is to allow the use of a URI Template in place of
>> the form element action attribute, and to use form elements to provide
>> the replacement values, e.g.
>>
>> <form template="http://example.org{-prefix|/|foo}?bar={bar}"
>>      method="POST">
>>  Foo: <input name="foo" type="input" >
>>  Bar: <input name="bar" type="input">
>> </form>
> 
> 
> What's the backward-compatibility story of this feature? (Both behavior
> of URI templates in legacy browsers and ensuring that existing content
> doesn't use braces.)
> 

Received on Monday, 17 December 2007 10:22:27 UTC