Score:0

Cannot set #return_value for Webform checkbox in custom webform composite

ca flag

For a checkbox webform element, there is a property '#return_value' so you can return another value than 'TRUE' if the checkbox is checked. I cannot set this property in a custom webform composite I build programmatically (extending WebformCompositeBase). I still get returned 'true' in my submission data. If i create the checkbox in a composite build with the UI everything works. So I think I'm doing something wrong.

This is the code in my composite:

$elements['test'] = [
 '#type' => 'checkbox',
 '#title' => 'Test'
 '#return_value' => 'test_value'
]

I'm using webform 6.2.0-beta5.

Am I doing something wrong or might this be a bug?

Thanks in advance!

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.