Always sending a collection confirmation email

Hello!

I am setting up a collecting form using the Collecting module. I currently have the user email field required and would like to automatically send a confirmation email to the user every time they complete a submission. Is there a way to do this? By default, the “email me my submission” field is visible and unchecked. My first thought was to make it checked and invisible, but after some digging I was unable to get that to work. Is this a viable solution? If so, how would I implement it?

Thank you!

I apologize for the delay. If you’re comfortable modifying the code, the easiest way to do this is to open Collecting/src/Api/Representation/CollectingFormRepresentation.php and change this:

$form->add([
    'type' => 'checkbox',
    'name' => sprintf('email_send_%s', $this->id()),
    'options' => [
        'label' => 'Email me my submission', // @translate
    ],
]);

To this:

$form->add([
    'type' => 'hidden',
    'name' => sprintf('email_send_%s', $this->id()),
    'options' => [
        'label' => 'Email me my submission', // @translate
    ],
    'attributes' => [
        'value' => '1',
    ],
]);