[development] form with confirmation (sometimes)
Pierre Rineau
pierre.rineau at makina-corpus.com
Thu Jul 2 10:09:42 UTC 2009
The $form_state['rebuild'] forces the form API to rebuild the same form,
using the same processing function, but instead of giving a empty
$form_state, it gives a full filled array with values you set into.
Somehow, in validate then submit, you do a $form_state['delete'] =
array(<your nid's here>), then, in you processing form function, you can
catch the $form_state if not empty (and filled with your 'delete'
attribute), then you can use a if statement to build a different form
(in your case, a simple config_form(), with an altered '#submit' which
will be the real delete operation submit callback).
Hope it helps.
Le jeudi 25 juin 2009 à 19:33 +0200, Lluís a écrit :
> I have taken a look to these funcions but I cannot see how
> $form_state['rebuild'] = TRUE;
> make confirmation appear.
>
> On Thu, Jun 25, 2009 at 7:13 PM, Michael Prasuhn<mike at mikeyp.net> wrote:
> > Look at node module, specifically node_admin_nodes() and
> > node_admin_nodes_validate() and node_admin_nodes_submit() which are all
> > found in node.admin.inc in Drupal 6. It provides this same functionality -
> > it only shows a confirmation form if the operation is to delete nodes.
> >
> > -Mike
> >
> > On Jun 25, 2009, at 9:29 AM, Lluís wrote:
> >
> >> I have a form to allow deleting some variables. If the deleted item is
> >> 'empty' it should be possible to delete it without any problem; but
> >> full items should have a 'confirmation' step before deleting them.
> >>
> >> I have read http://drupal.org/node/387674 and
> >> http://drupal.org/node/385640; but in my case I need to pass an array
> >> to the confirmation form, and I think it has to be an easier way to
> >> allow a "Are you sure you want to do this?".
> >>
> >> Any hint is welcome.
> >>
> >> --
> >> *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.
> >
> > __________________
> > Michael Prasuhn
> > 503.488.5433 office
> > 971.244.2595 cell
> > 503.661.7574 home
> > mike at mikeyp.net
> > http://mikeyp.net
> >
> >
> >
> >
> >
> >
> >
>
>
>
More information about the development
mailing list