Problem/Motivation

The example given here: https://git.drupalcode.org/project/examples/-/blob/3.x/modules/form_api_... is broken. If you click the form submit button it does not run the submitForm() function but just calls the AJAX handler.

Steps to reproduce

I copied the code into a new form on my own site. Even if I give the buttons unique #name attributes the submit function never runs. Instead, clicking submit just does the same as clicking 'Add more'.

Proposed resolution

Figure out why Drupal thinks the wrong button is being clicked and correct it.

Comments

rkent_87 created an issue. See original summary.

rkent_87’s picture

This can be closed - I found a preprocess function that was unsetting the #value attribute for submit buttons in my custom theme, causing the Ajax to fail

baikho’s picture

Status: Active » Closed (works as designed)