* Patrick Quinn-Graham <pf...@mac.com> [2007-04-20 20:00]: > On 20-Apr-07, at 6:02 PM, A. Pagaltzis wrote: > >What you want to do is use single-submit-button forms, not > >links. (Eg. you have one <form> for each action rather than a > >link, with a submit button as UI to trigger the action.) > > You can achieve this in a couple of different ways. > > The easiest is probably to use the <button> element, and style > it (which works even in Safari, as far as I remember) to make > it look like a link.
Unfortunately IE doesn’t support <button>. > The other option is use AJAX. So you could, on your link: > > <a href="/settings/subscribers_only" onclick="magicFunction > (this)">Accept messages from Subscribers only</a> > > (where magicFunction uses AJAX to do a POST request with some > extra bit added to say "this is an ajax request: really do it, > and then update the link to say "Accept message from All", or > whatever) > > The other, arguably nicer, option is to do such a magicFunction > on the input element itself. (ie. so when the value is changed > just do a silent ajax POST, showing an error message on > failure) I don’t like that, actually. Personally I *like* the fact that I can throw away my “changeset” simply by closing/refreshing the browser window. > Both options could easily work for non-Javascript scenarios > (the first by showing a "Do you really want to do this?" form, > or whatever; the second by ensuring you can do a traditional > full-page submit of the form). You preaching to the converted: <http://plasmasturm.org/log/292/> :-) Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>