[thelist] Another submit button for cancel

Andrew Clover and-evolt at doxdesk.com
Wed Dec 15 10:36:28 CST 2004


Graham Bird <Graham.Bird at rspb.org.uk> wrote:

> I have a form on which I want to provide a Cancel button.
> Is this a good idea,

If you're doing a web application of some sort, where there's a main app 
page that you can return to on cancelling, maybe. If the form is in a 
pop-up, probably.

If it's just a simple form as part of a normal website (eg. contact 
form), which can be linked to from many places, then probably not. Just 
using the Back button would make much more sense in this situtation.

> or am I stumbling blindly into a world of pain?

Keep in mind that when there are two submit buttons browsers will submit 
the name/value pair for either the first one or neither one when the 
form is submitted by pressing Enter. (This is against the spec, but 
browsers do it anyway, emulating old bugs.)

In your case with the main button first this isn't too bad as you can 
just check that "submit=Cancel" is *not* passed. But quite often you 
want a different button first, and in this case a nasty workaround would 
be needed.

Another approach (that also doesn't require that one rely on the value 
of the submit button, which is a good thing as on-page text shouldn't 
really drive a web application) would be to put 'Cancel' in a different 
form completely, with a different method/action, and just move it into 
place by the 'Send' button using CSS Positioning.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/


More information about the thelist mailing list