I have webform created via Webform UI, and it's multi-step webform.
In second step ('personal information') I add custom button using HOOK_form_alter
with following code
'generate_pdf' => [
'#type' => 'submit',
'#value' => t('Generate PDF'),
'#limit_validation_errors' => [],
'#submit' => ['generate_pdf_template'],
]
function generate_pdf_template takes values from $form, $form_state inserts them into twig templat, creates PDF and automatically downloads it.
My issue is, that this generate_pdf button submits the form and user is not able to send form via original submit button. Can I somehow prevent submission when generate_pdf
is clicked so user can download PDF and still be able to send webform with original button and webform's handlers.