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)));
}

2 Answers 2

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';
0
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.

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.