- Issue created by @musa.thomas
- π³πΏNew Zealand quietone
Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.
- πͺπ¬Egypt Ahmed Eldesoky
I can confirm this issue when placing the ajax callback within the same class that provides the options form
however a simple fix would be placing the ajax callback on your .module file
something like this/** * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($original_form, $form_state); $form['test']=[ "#type" => "select", '#default_value' => "test", "#title" => t("Component"), "#options" => ['test'=>'test','test2'], '#ajax' => [ 'callback' => '_your_module_ajax_callback', 'wrapper' => 'test', 'effect' => 'fade', '#suffix' => '<div id="test"></div>' ], '#executes_submit_callback' => FALSE, '#required' => TRUE, ]; }
and in your .module file
function _your_module_ajax_callback($form,FormStateInterface $form_state ) { return ['#markup'=>'hello']; }