- Issue created by @solarDog
- 🇮🇳India arunkumark Coimbatore
@solarDog
Yes, you can use the
hook_form_alter()
and add your additional form field. Replace the default submit handler with your custom submit. Write the logic to handle your new fields into it.Example:
/** * Implements hook_form_alter(). */ function MODULE_NAME_form_alter(array &$form, FormStateInterface $form_state, $form_id) { if ($form_id == 'webform_email_reply_form') { $form['new_field'] = [ '#type' => 'textfield', '#title' => 'First name', '#required' => TRUE, ]; // Custom submit handler. $form['#submit'][] = 'MODULE_NAME_webform_email_reply_form_submit'; } } /** * Custom submit handler for webform_email_reply_form. */ function MODULE_NAME_webform_email_reply_form_submit($form, FormStateInterface $form_state) { $new_field = $form_state->getValue('new_field'); // Do the Other logic. }
- Status changed to Closed: works as designed
about 2 months ago 2:27pm 29 October 2024 - 🇮🇳India arunkumark Coimbatore
Moving to works as designed. Feel free to open, if needed any support.