function Callbacks::dateCallback
Same name in other branches
- 9 core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php \Drupal\ajax_forms_test\Callbacks::dateCallback()
- 8.9.x core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php \Drupal\ajax_forms_test\Callbacks::dateCallback()
- 10 core/modules/system/tests/modules/ajax_forms_test/src/Callbacks.php \Drupal\ajax_forms_test\Callbacks::dateCallback()
Ajax callback triggered by date.
File
-
core/
modules/ system/ tests/ modules/ ajax_forms_test/ src/ Callbacks.php, line 30
Class
- Callbacks
- Simple object for testing methods as Ajax callbacks.
Namespace
Drupal\ajax_forms_testCode
public function dateCallback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$date = $form_state->getValue('date');
$response->addCommand(new HtmlCommand('#ajax_date_value', sprintf('<div>%s</div>', $date)));
$response->addCommand(new DataCommand('#ajax_date_value', 'form_state_value_date', $form_state->getValue('date')));
return $response;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.