Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I return back to the previous form page from the PRE_SUBMIT event with form values? #15944

Open
Manasmd opened this issue Mar 4, 2024 · 0 comments

Comments

@Manasmd
Copy link

Manasmd commented Mar 4, 2024

I have a custom Entity for a simple basic CRUD operation. The form is rendering fine and works well. However, I am doing some custom validation in the PRE_SUBMIT and would like to redirect back to the form page with user's previously inserted values.

I have tried it through the URL params and also sessions but both doesn't work.


  $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
    $data = $event->getData();
    if($data['name'] == "unavailable"){
   
     // I would like to redirect back to the form page and pre-fill the name field.
     // I have tried to set it through URL params and as well as in the session (both doesn't) work.
     
     
    }
  }
  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant