I've updated my Drupal project from 9.5.3 to 9.5.7, but the submission button's #states
property stopped working.
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => 'Accéder au paiement',
'#enabled' => FALSE,
];
$form['actions']['submit']['#states'] = [
'enabled' => [
[
':input[name="name_1"]' => ['empty' => FALSE],
':input[name="name_2"]' => ['empty' => FALSE],
':input[name="name_3"]' => ['empty' => FALSE],
[
':input[name="name_4"]' => ['!value' => ''],
],
],
],
];
I rolled back to 9.5.3 and upgrade to each release to find out when it stopped working.
Turns out it's from the 9.5.6 release. On the 9.5.7 release, the button is always enabled, but changing my other inputs toggle the class form-disabled
and the disable attribute is not triggered.
How can I fix it?