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

1 Answer 1

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 and acknowledge you have read our privacy policy.

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