By smustgrave on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.5.x, 11.2.x
Introduced in version:
10.5.0, 11.2.0
Issue links:
Description:
A new key '#submit_button', with a boolean value, is added to the button form '#type'. This allows for custom client-side behavior.
When TRUE, the form is submitted to Drupal, this is current behavior. The default value is TRUE.
When FALSE, the button element will no longer submit the form when clicked. Instead, the button behaves as an HTML button with the 'type' attribute set to 'button'. Clicking will not trigger a page refresh.
Example
$form['submit-button'] = [
'#type' => 'button',
'#submit_button' => TRUE,
'#value' => $this->t('Submit'),
];
$form['submit-button-no-submit] = [
'#type' => 'button',
'#submit_button' => FALSE,
'#value' => $this->t('Button but you can\'t submit'),
];
Impacts:
Module developers