You are here

function registration_checkin_search_form in Entity Registration 7.2

Form builder for the checkin page search function.

1 string reference to 'registration_checkin_search_form'
registration_checkin_list_page in modules/registration_checkin/registration_checkin.pages.inc
Page callback: Show a list of active registrations that can be checked in.

File

modules/registration_checkin/registration_checkin.module, line 176
Entity Registration registrant checkin workflow and UI for registration.

Code

function registration_checkin_search_form($form, &$form_state, $entity_type, $entity_id) {
  $form = array();

  // Enable both a keyboard "return" key or a click on the submit
  // button to trigger the ajax refresh. Same callback for both.
  $form['search_keys'] = array(
    '#type' => 'textfield',
    '#title' => t('Search'),
    '#title_display' => 'invisible',
    '#size' => 15,
    '#default_value' => '',
    '#attributes' => array(
      'title' => t('Enter the terms you wish to search for.'),
      'placeholder' => t('Email or name'),
    ),
    '#ajax' => array(
      'callback' => 'registration_checkin_search_form_submit',
      'wrapper' => 'registrant-list',
      // Setting this to 'keyup' has the unfortunate loss-of-focus bug. This
      // means you have to tab back into the box to continue typing. Fixing
      // this would allow us to get the "as you type" update interaction.
      'event' => 'change',
    ),
  );

  // Hidden fields for access in ajax callback.
  $form['entity_type'] = array(
    '#type' => 'hidden',
    '#value' => $entity_type,
  );
  $form['entity_id'] = array(
    '#type' => 'hidden',
    '#value' => $entity_id,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Search'),
    '#ajax' => array(
      'callback' => 'registration_checkin_search_form_submit',
      'wrapper' => 'registrant-list',
    ),
  );
  $form['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset'),
    '#ajax' => array(
      'callback' => 'registration_checkin_search_form_reset',
      'wrapper' => 'registrant-list',
    ),
  );
  return $form;
}