1 ajax_example_advanced.inc ajax_example_advanced_commands_remove_callback($form, $form_state)

Callback for 'remove'.

See also

ajax_command_remove()

File

modules/examples/ajax_example/ajax_example_advanced.inc, line 362
AJAX Commands examples.

Code

function ajax_example_advanced_commands_remove_callback($form, $form_state) {
  $commands = array();
  $should_remove = $form_state['values']['remove_command_example'];
  $should_remove_string = $should_remove ? 'TRUE' : 'FALSE';
  if ($should_remove) {
    $commands[] = ajax_command_remove('#remove_text');
  }
  else {
    $commands[] = ajax_command_html('#remove_div', "<div id='remove_text'>text to be removed</div>");
  }
  $commands[] = ajax_command_replace("#remove_status", "<div id='remove_status'>Updated remove_command_example (value={$should_remove_string} " . date('r') . "</div>");
  return array('#type' => 'ajax', '#commands' => $commands);
}