1 ajax_example_autocomplete.inc ajax_example_node_by_author_autocomplete_submit($form, &$form_state)

Submit handler for node lookup unique autocomplete example.

Here the nid has already been placed in $form_state['values']['node'] by the validation handler.

Parameters

array $form: Form API form.

array $form_state: Form API form state.

Return value

array Form API array.

File

modules/examples/ajax_example/ajax_example_autocomplete.inc, line 414
ajax_example_autocomplete.inc

Code

function ajax_example_node_by_author_autocomplete_submit($form, &$form_state) {
  $node = node_load($form_state['values']['node']);
  $account = user_load($node->uid);
  backdrop_set_message(t('You found node %nid with title !title_link, authored by !user_link', 
  array(
    '%nid' => $node->nid,
    '!title_link' => l($node->title, 'node/' . $node->nid),
    '!user_link' => theme('username', array('account' => $account)),
  )
  ));
}