[development] avoid resubmitting a form when refreshing

Lluís Forns enboig at gmail.com
Sat Jul 10 09:17:14 UTC 2010


I user drupal FAPI, on monday I will send the code. I insert the form
in hook_view() using drupal_get_form('myform', $args).

2010/7/9 Randy Fay <randy at randyfay.com>:
> 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
>
>



-- 
*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.


More information about the development mailing list