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

[whatwg] Targetting different anchors after submitting the form

From: Ric Hardacre <whatwg@cycloid.f9.co.uk>
Date: Mon, 06 Mar 2006 16:11:11 +0000
Message-ID: <440C5F1F.7090003@cycloid.f9.co.uk>


ROBO Design wrote:

>>
>> Is it too much to add a new attribute for something like this?
>>
>> Note that the server cannot see any of these anchor urls. Only the UA 
>> is able to scroll to correct position after receiving output from the 
>> server.
>>
> 
> Maybe adding an attribute for this sole purpose is "too much" to ask 
> for. There are isolated cases where this is needed (I myself didn't need 
> this ever).
> 
> You can, however, modify the action of the form via DOM, by having an 
> event listener for the submit event. I suppose you've used this.
> 
> 

I've used multiple submit buttons myself in a couple of ways, most 
recently this has been used in an order enquiry search form where the 
admin can list orders by order no, customer order no, by customer or by 
product code. i do this by having one text input box and multiple submit 
buttons, and the client likes it that way very much indeed. a more 
everyday use i can think of off of the top of my head is this:

<form action="order_place.asp">
<input type="submit" value="PLACE ORDER">
<input type="submit" value="SAVE QUOTE" action="quote_add.asp#thanks">
<input type="submit" value="RECALCULATE TOTALS" action="#here">
</form>

where

the first button invokes the default form action (user hands over their 
cash)

the second overrides it with it's own target page (converting the user's 
basket into a quote that they can refer to later and place as an order)

the third submits the page back to itself (as per action="") but 
specifies an anchor to jump to (e.g. if the basket and totaliser is at 
the foot of the page)


as an aside, if i could go back in time i would change the original spec 
so that the text displayed on a submit button is separate from the value 
submitted, thus:

<input type="submit" name="ordertype" value="sales" text="PLACE SALES 
ORDER">
<input type="submit" name="ordertype" value="sample" text="PLACE SAMPLE 
ORDER">
<input type="submit" name="ordertype" value="pro" text="REQUEST PRO RATA 
INVOICE">




ric hardacre
www.cyclomedia.co.uk
Received on Monday, 6 March 2006 08:11:11 UTC

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