You are here

function redhen_contact_select_user_callback in RedHen CRM 7

Ajax callback when changing the type of linkage to create.

_state

Parameters

$form:

Return value

array

1 string reference to 'redhen_contact_select_user_callback'
redhen_contact_contact_user_form in modules/redhen_contact/includes/redhen_contact.forms.inc
Return a form for managing contact/user links.

File

modules/redhen_contact/includes/redhen_contact.forms.inc, line 425
Forms for creating, editing, and deleting contacts.

Code

function redhen_contact_select_user_callback($form, &$form_state) {

  // Hack to prevent validation on ajax postback:
  // http://drupal.org/node/831900#comment-3124386
  drupal_get_messages('error');
  form_set_error(NULL, '', TRUE);

  // Clear any potential error messages.
  $commands[] = ajax_command_remove('#messages');

  // Return the entire form since we need a certain structure for the user
  // account validation to work properly.
  $commands[] = ajax_command_replace('#redhen-contact-user-form', render($form));
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}