I am using drupal 8 fapi and i have user case as below
I have a form on https://example.com/landing-page and I submit the form and there are validation errors .the page should reload as https://example.com/landing-page#lead-form.
Is there any hack we can implement?
I came with logic
if validation has error set form redirect page to example.com/landing-page#lead-form
if($form_state->getErrors() ) { $response = new TrustedRedirectResponse('example.com/landing-page#lead-form'); $form_state->setResponse($response); }
some how its not working.
Is there any way we can change the url to example.com/landing-page#lead-form and show the validation error at same time .