1

How can I uncheck a checkbox programmatically in Drupal 8. I need this in an ajax call, when an option is selected, a checkbox must be unchecked

1

After a lot of trial and error, I found out:

Imagine a checkbox with name 'Coffee' has one option: ['Y' => 'I want an espresso'].

To uncheck this selection, enter: $form['Coffee']['Y'][#checked]=false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.