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:
- default action: /patients
- rendered action: form_action_p_pvdeGsVG5zNF_XLGPTvYSKCf43t8qZYSwcfZl2uzM
I tried modifying the action and set the default route but it reload the page and do not save changes.
Is there a way to solve this issue?
Thanks!
Comments
Comment #2
dromansab commentedComment #3
dromansab commentedNobody nows if there is a way to solve this issue?
Comment #4
aaronbaumanSounds like this is probably the same issue as #3381413: Ajax 404 Error