0

I'm trying to port a working FAPI module from D6 to D7. I'm passing a POST value to the form and then assigning using :

 $link = check_url(substr($_POST['file_link'], 0, 300));
     $form['anu_download_file_link'] = array(
        '#type' => 'value',
        '#value' => $link,
      );

But when form is submitted the form is built again but this POST data file_link is missing in the submit handler.

In D6 $form['#cache']=true was working fine which avoided recreating of the form but now in D7 it does not seem to work.

How can pass POST values to the submit handler?

6
  • how are you sending the post data? Jan 19 '13 at 12:50
  • what does this action link do "downloadsbrt/90n-brt-download-file-now" is it calling a url inside drupal? Jan 19 '13 at 13:05
  • 2
    Shouldn't you be using $form_state rather than POST if you're using the FAPI? Jan 19 '13 at 13:08
  • I dont see the form element with the name file link in there. Jan 19 '13 at 13:29
  • David Meister is right: if you are using POST you are doing it wrong.
    – user49
    Jan 20 '13 at 0:29
0

We need to use in D7 :

$form_state['cache'] = TRUE;
$form_state['no_cache'] = FALSE;

instead of

$form['$cache']=TRUE in D6

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.