Ajax callback on parent element is "cut" down

Created on 8 December 2015, over 8 years ago
Updated 11 April 2024, 5 months ago

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.

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component
FormΒ  β†’

Last updated less than a minute ago

Created by

πŸ‡©πŸ‡ͺGermany seppelM

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    There has been no discussion here for 8 eight years. And it seems that #2 answers the question, but I don't know the form system.

    Since we need more information to move forward with this issue, I am setting the status to Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024