[Catalyst] how to confirm before deleteing

Wade Stuart wbs at grepit.net
Wed Jan 21 17:49:17 GMT 2009


On Wed, Jan 21, 2009 at 10:22 AM, Simon Wilcox
<simonw at digitalcraftsmen.net>wrote:

> Dave Howorth wrote:
>
>> Paul Falbe wrote:
>>
>>> That works thank you very much.  Don't know how many google searchs I d=
id
>>> trying to find that out!
>>>
>>
>>  Rodrigo-51 wrote:
>>>
>>>> Paul, how about a javascript confirm() box?
>>>>
>>>
>> ... and if the user has Javascript disabled? ????
>>
>
> Or if you have some like Google's ill-fated prefetch running, caching all
> the links it finds on a page ?
>
> GETing a link should really only be used when the action is idempotent. If
> it changes stuff then you ought to use a POST via a form button.
>
>
 YES!  There are rare cases where a get may enable consequences,  but this
is not one of them.

<form method=3D"POST" action=3D"/yourapp/account/do_delete">
<input type=3D"hidden" name=3D"accountid" value=3D"23948234">
<input type=3D"submit" name=3D"delete"
 value=3D"Delete My Account"
 onClick=3D"return confirm(
  'Are you sure you want to delete your account?');">
</form>


This both checks if the user really wants to delete (if js is enabled) and
also uses a post to delete data via the app.

-- =

Thanks!

Wade Stuart

Phone:  917-363-6164
IM: SpaceMuscles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090121/3e28c=
342/attachment.htm


More information about the Catalyst mailing list