- Issue created by @dromansab
Hello,
I have installed this module in a Drupal 11 installation. In this project, I need to load a view dinamycally with ajax and put inside a div.
To do this, I amb rendering the view inside a controller:
$view = \Drupal\views\Views::getView('patient');
if (is_object($view)) {
$view->setDisplay('default');
$view->preExecute();
$view->setArguments([\Drupal::currentUser()->id(), $user->id()]);
$view->execute();
$view->render();
}
return new Response(\Drupal::service('renderer')->render($view->render()));
And then, I amb loading it with js:
$("#patient-view").load('/patient/3');
The view is rendered properly, but when I submit the form it redirects to a not found page. I have checked the generated html and I found that the form action is diferent.
By default, the form action is the same than current page but on rendering, the form action is a token:
I tried modifying the action and set the default route but throws the following error:
"The form has become outdated. Press the back button, copy any unsaved work in the form, and then reload the page."
Is there a way to solve this issue?
Thanks!
Active
1.0
Code