I have the weird problem that an Ajax enabled form that just worked stopped working - and I have not a clue what is causing this and when it stopped to work. The form itself has no changes for months now and I did not find any code updates which may interfere with this form.
The form is defined in its own form class which extends FormBase. The Ajax functionality is added with the following code in buildForm() method:
$form['form_container']['actions']['submit'] = [
'#type' => 'submit',
'#value' => 'Submit',
'#ajax' => [
'callback' => '::ajaxResponse'
],
'#attributes' => [
'class' => ['js-show-throbber']
],
'#weight' => -45,
];
In the form class the method is defined:
public function ajaxResponse(array $form, FormStateInterface $form_state)
When I set a breakpoint within this method for XDebug the script never stops, the process within this methods are not running.
There is no info in browser's console, it is not working in any browser and in watchdog of Drupal are no entries. For me it seems that somehow the bridge between browser / JavaScript world and the form PHP class is broken. I use the exact same PHP code for many other forms without any problem.
My question: can anybody give me a hint how exactly the bridge between browser and form class is created when the form gets rendered? How can I find out if there is a problem in the PHP form class or somewhere in JavaScript?
'callback' => [get_class($this), 'ajaxResponse'],