I don't know, if this is a bug, support or feature request.
My setup:
I've created a custom FormElement which generates a wrapper containing some textfields.
- added the #process => 'processAjaxForm' entry in getInfo()
Next I define the #ajax setup in my form array.
class AjaxTestForm extends FormBase {
public function buildForm(array $form, FormStateInterface $form_state) {
$form['my_ajax_field'] = [
'#type' => '',
'#ajax' => [
'callback' => array($this, 'ajaxFoo'),
'event' => 'change',
'progress' => array(
'type' => 'throbber',
'message' => t('Verifying value'),
),
],
];
$form['submit'] = [
'#type' => 'submit',
'#value' => 'go',
];
return $form;
}
public function ajaxFoo(array $form, FormStateInterface $form_state) {
var_dump($form_state->getTriggeringElement());
die;
}
}
Unfortunately no form values get submitted on the ajax request. ($_POST parameters for all form elements are missing.
Is this working as expected, or am I missing anything in the FormElement class?
My workaround for now is, adding the #ajax setup to the descendant fields and unsetting it for the #parent element.
Besides, the error message saying "reached max_upload_filesize" is a bit strange here. And there is no point of debugging/investigating this kind of error, because no error.log or watchdog entry is created.
But I guess this is used to handle "hacky" form submissions.