[development] avoid resubmitting a form when refreshing

Randy Fay randy at randyfay.com
Fri Jul 9 13:45:54 UTC 2010


I suspect you didn't use Drupall's Form API - and you should. If you're not
using it, then you can use the Form Examples in the Examples project to come
up to speed on it - http://drupal.org/project/examples. The default behavior
of the Form API is to not do what you're concerned about.

In Drupal, one would not normally use $_REQUEST, $_GET, and friends (or only
as a last resort). Normally you use more Drupal-esqe APIs.

-Randy

2010/7/9 Lluís Forns <enboig at gmail.com>

> I have added a form to a custom node using hook_view. My problem is
> that if I refresh the browser after submitting the form it is
> submitted again. Is there a way to avoid this?
>
> I tried adding  "$_REQUEST['destination'] = 'node/'.$nid; " at the end
> of submit function but it don't work.
>
> Thanks
>
> --
> *Les normes hi són perquè hi pensis abans de saltar-te-les
> *La vida és com una taronja, què esperes a exprimir-la?
> *Si creus que l'educació és cara, prova la ignorància.
> *La vida és com una moneda, la pots gastar en el que vulguis però
> només una vegada.
> *Abans d'imprimir aquest missatge, pensa en el medi ambient.
>



-- 
Randy Fay
Drupal Module and Site Development
randy at randyfay.com
+1  970.462.7450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100709/6bedbf14/attachment.html 


More information about the development mailing list