W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2006

[whatwg] Targetting different anchors after submitting the form

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Tue, 07 Mar 2006 09:07:37 +1100
Message-ID: <440CB2A9.9060403@lachy.id.au>
Mikko Rantalainen wrote:
> Currently it's possible to do stuff like this
> 
> <form action="url#anchor">
> <input name="foo" type="submit">
> <input name="bar" type="submit">
> </form>
> 
> and the UA scrolls down to element with id "anchor" on the page returned 
> by the server. It would be nice to be able to set target anchor on 
> per-submit-button basis.
> 
> Perhaps something along the lines
> 
> <form action="url">
> <input name="foo" type="submit" anchor="xfoo">
> <input name="bar" type="submit" anchor="xbar">
> </form>
> 
> would result to action urls "url#xfoo" and "url#xbar" respectively. 

You could get the server to send a 303 See Other response and set 
Location: http://example.com/url#foo.

RFC 2616:
303 See Other

    The response to the request can be found under a different URI and
    SHOULD be retrieved using a GET method on that resource. This method
    exists primarily to allow the output of a POST-activated script to
    redirect the user agent to a selected resource.

-- 
Lachlan Hunt
http://lachy.id.au/
Received on Monday, 6 March 2006 14:07:37 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:45 UTC