How to create and return html with submitted form data - Drupal 8

211 views Asked by At

I have created a customized form with Form API by Drupal 8.

I need to use the data obtained through the form to run a research in the database and print the results with html onto the same page.

I created the form through the buildForm method and I got the data obtained through the form with the submitForm method.

Is there a way to print the results obtained through the form onto the same page through HTML blocks?

1

There are 1 answers

0
Sharklalu On

You have to create a block and in this form do this following code :

  public function build() {
    return $this->formBuilder->getForm('Drupal\your_module\Form\your_form');
  }