I have a very simple ajax-form containg this:
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Teilen',
'#ajax' => array(
'callback' => '::ajaxShareButton',
'wrapper' => $ajax_id,
)
);
I made routing for this form - behaviour is like expected: clicking on submit alters the form in 0.5 seconds.
Now I put this form in a simple block (via getForm):
public function build() {
$form = \Drupal::formBuilder()->getForm('Drupal\zag_base\Form\ShareContent');
return $form;
}
The form renders in the block, but clicking on submit alters the form now in about 3 seconds !
After some debugging I traced that eventually the whole page was rendered internally - It stops at a breakpoint in \Drupal\Core\Render\MainContent\HtmlRenderer::prepare
In both cases the ajax-call is the same:
http://d8/myajax?ajax_form=1&_wrapper_format=drupal_ajax
any Idea ?