[whatwg] Targetting different anchors after submitting the form

Ric Hardacre whatwg at cycloid.f9.co.uk
Mon Mar 6 08:11:11 PST 2006



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






More information about the whatwg mailing list