0

The structure of my form is as follows:

Form is built here

function mymodule_member_search_form

The form submission processing happens in the callback function

_mymodule_search_form_submit(&$form, &$form_state)

Here I am able to get the results and do the various processing I want and the final result I have stored in

if(isset($myvalues)){
        $form['results'] = array(
            '#type'     => 'item',
            '#markup'   => $myvalues,
        );
    }

But the values are not printed on the page after form submission, I have also set

$form_state['rebuild'] = TRUE;

in the above submission function

What am I missing here?

Additional Information is this form I have added as a block. So do I have to pass this ass the result of block? If yes, how do I do that?

Thanks.

  • May you share the code you are using? Without seeing the actual code it is rather difficult to answer the question without guessing. – kiamlaluno Nov 11 '14 at 7:32
0

I believe you start with a fresh form in mymodule_member_search_form(), i.e. with $form = array();. Is it correct? If so, your $form['results'] are not in the form returned by mymodule_member_search_form(). You should either do the processing in form callback itself or fetch results from the form prior to redefining it.

  • Yes it has the $form = array(); which redefines the form. Although the submission callback function does have the value. It seems likes its lost because of this fresh form. Currently I just store the results in a session and display from there. Not sure whats the alternative for that? – pal4life Nov 11 '14 at 23:46
  • You can e.g. pull results from $form_state in mymodule_member_search_form(). – Alex Bukach Nov 12 '14 at 3:47
  • Thanks for working with me on this. Clearing this further, I am able to pull and manipulate results, I am having trouble with displaying it on the page after the form reloads. Any clues for that? Thanks. – pal4life Nov 12 '14 at 21:06
  • @pal4life, it seems to me we have figured out how you can do it. To sum up: you should set $form['results'] in mymodule_member_search_form(). – Alex Bukach Nov 13 '14 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.