The #ajax property is ignored on child elements of Actions elements if the child element has defined the #dropbutton property

Created on 19 December 2017, about 7 years ago
Updated 17 March 2022, almost 3 years ago

Problem/Motivation

The Actions element includes a #process callback that renders all children with the #dropbutton property defined, early, before those children are run through the doBuildForm() method of the FormBuilder class. This causes the #ajax property, and most likely other properties, to be ignored.

Proposed resolution

The Actions element class already has an @todo comment to move this function from #process to #pre_render, so lets do that.

This code was added to the Drupal 8 code base in #2326891: Convert system_element_info() to Element classes , and it appears that it came from the Drupal 7 code base, so this may require a backport to Drupal 7, but I'm not 100% sure.

Remaining tasks

Review and test the attached patch.

Original report by saranya purushothaman

I am trying to implement ajax for node submit. For dropdown button ajax is not working. If it is single button without grouping ajax is working.

Can any one help me!

My code is here:

 $form['actions']['publish']['#ajax'] = [
    'callback' => 'node_ajax',
    'wrapper' => 'node-form',
    'effect' => 'fade',
    'progress' => array(
       'type' => 'throbber',
    ),
 ];
🐛 Bug report
Status

Needs work

Version

10.1

Component
Render 

Last updated about 8 hours ago

Created by

🇮🇳India saranya ashokkumar

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.

Production build 0.71.5 2024