0

Is a module required to submit a form ? I get a standard form from our designer and try to send it as follow:

<form action="/kontakt" class="sky-form" method="POST" name="kontakt">
  ...
  <input type="submit" class="btn btn-u btn-u-lg" value="Nachricht absenden">
</form>

I have tried different function calls without success

MYTHEME_form_submit(array &$form, FormStateInterface $form_state)
contact_form(array &$form, FormStateInterface $form_state)
contact_form_submit(array &$form, FormStateInterface $form_state)
MYTHEME_contact_form_submit(array &$form, FormStateInterface $form_state)
...

i have to say, that i am a beginner in Drupal 8, so help is very appreciated.

thank you.

1 Answer 1

1

Two ways to approach this.

One way is to use the Webform module. If this is just a simple contact form, you can get this done with Webform in five minutes.

The second way is create a custom module that implements a route, Form class and related methods. Wouldn't take an intermediate long, but a beginner should try Webform first.

You cannot simply paste form HTML into a twig file and expect it do anything. Drupal is ignorant to its existence and therefore no hooks will work, as you already saw.

https://www.drupal.org/project/webform

1
  • Kevin, thank you, i'll give it a try. The problem is, there are dependicies on some checkboxes. They should show some other fieldsets. I'll see.
    – Shao Khan
    Apr 24, 2017 at 9:32

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.