function ajax_example_advanced_commands_changed_callback

Callback for 'changed'.

See also

ajax_command_changed()

1 string reference to 'ajax_example_advanced_commands_changed_callback'
ajax_example_advanced_commands in ajax_example/ajax_example_advanced.inc
Form to display the AJAX Commands.

File

ajax_example/ajax_example_advanced.inc, line 285

Code

function ajax_example_advanced_commands_changed_callback($form, $form_state) {
    $checkbox_value = $form_state['values']['changed_command_example'];
    $checkbox_value_string = $checkbox_value ? "TRUE" : "FALSE";
    $commands = array();
    if ($checkbox_value) {
        $commands[] = ajax_command_changed('#changed_div', '#changed_div_mark_this');
    }
    else {
        $commands[] = ajax_command_replace('#changed_div', "<div id='changed_div'> <div id='changed_div_mark_this'>This div can be marked as changed or not.</div></div>");
    }
    $commands[] = ajax_command_replace("#changed_status", "<div id='changed_status'>Updated changed_command_example to {$checkbox_value_string}: " . date('r') . "</div>");
    return array(
        '#type' => 'ajax',
        '#commands' => $commands,
    );
}