Hi people,
i developed a little module to generate voucher-codes out of userpoints. The user can choose how many userpoints he wants to redeem. I.e. 250, 500, 750 or 1000. To make that possible, my module (called "userpoints_redeem") has a little form with a dropdown-menue that holds the values and a submit-button. All that is shown in a block.
I implemented the following workflow: _FORM -> _VALIDATE -> _SUBMIT and everthing works fine (the feedback for the user that the transaction has happened is solved with drupal_set_message()).
Now i want to insert a confirm_form to let let the user confirm the transaction. But the confirm_form doesnt show up in the block. Means like: nothing happens.
My question: is it possible to show the confirm_form in that block? Or do i have to put that all in the page? I havent found anything on the net about it.
Thanks in advance
Fabian
Comments
This works for
This works for me:
Contact me to contract me for D7 -> D10/11 migrations.
Hm - i got the following
Hm - i got the following workflow and its definately happening nothing after i pressed the submit-button. Do you know whats wrong with it?
You aren't calling this
You aren't calling this function anywhere: userpoints_redeem_form_confirm()
Contact me to contract me for D7 -> D10/11 migrations.
Thanks again ... Well - im
Thanks again ...
Well - im also not calling the _VALIDATE-function explicitly... i thought _form_confirm is a hook thats implemented automatically into the workflow after the validate-function. But maybe i was wrong in assuming this :)
So where should i return the confirm_form in my workflow?
Thanks in advance
_validate() and _submit()
_validate() and _submit() functions are automatically called by drupal_get_form(), but _confirm() isn't called (as far as I know at least - I've never seen that anywhere).
Basically, you can re-write your form function like this:
Contact me to contract me for D7 -> D10/11 migrations.
man - that rocks!!! Thank you
man - that rocks!!! Thank you very much. This code is working as i wanted it to!
Even i dunno if that the correct/best way to solve this problem, it is solved ... so ;)
Thank you very much!
So I got your example
So I got your example working! Yes!
One caveat, had to add $form_state['rebuild'] = TRUE; right after setting confirm to true, otherwise the form would just reload its current state or do nothing.
So the submit function that worked for me (ignore php tag):
Thank you so much for the post!