0

I try to use code for redirecting after submitting a form, but I am getting the below error:

undefined function my_search_form_submit_funtion in form.inc.

Why do I get this error? Thank you. The module name is utility.

function utility_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['#submit'][] = 'my_search_form_submit_funtion';
  }
}
function my_search_form_submit_function(&$form, &$form_state) {
  $search_str = $form_state['values']['search_block_form'];
  $form_state['rebuild'] = TRUE;
  drupal_goto('search', array('query' => array('search_api_multi_fulltext' => $search_str)));
}
1

You have a typo error in your code.

Change

$form['#submit'][] = 'my_search_form_submit_funtion';

To

$form['#submit'][] = 'my_search_form_submit_function';
| improve this answer | |
0

You have spelling mistake in your function name, in the line $form['#submit'][] = 'my_search_form_submit_funtion'; you can replace 'funtion' with 'function' to make your code run perfect.

| improve this answer | |

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.