-
Notifications
You must be signed in to change notification settings - Fork 8
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
RFC about using Symfony UX Turbo #13
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea in general, though have some comments
I have fixed your comments, please let me know if it's good for you. |
+ $submitButton = $feedbackForm->get('submit'); | ||
+ if (!$submitButton->isClicked()) { | ||
+ return $this->render('feedback.html.twig', ['feedbackForm' => $feedbackForm]); | ||
+ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this should be below "Your code here"? I mean, we still want to execute all that custom code in below, but just return a different reponse, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this scenario, this code is here to handle the 'onchange' => 'this.form.submit()'
(auto-submit) part of the form. So it should not trigger the business code, it just re-renders the form with updated state.
// Your code here | ||
// ... | ||
|
||
return $this->redirectToRoute('home'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if so, maybe better to do the opposite.... if $submitButton->isClicked()
is clicked - do this return $this->redirectToRoute('home');
.
Otherwise, the execution will continue and call that return $this->render('feedback.html.twig', ['feedbackForm' => $feedbackForm]);
below.
Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think this is good to go!
Thank you for working on it!
Hello, and thank you for your work.
In my project I already use Symfony UX Turbo, so when I choose to use Dynamic Forms (and implement the JavaScript part) I saw an opportunity to have both working together.
In this PR I updated the README, but it's more to have a place to show you the idea and implementation.
This may even lead to a better integration between this package and Turbo Frame.
Let me know.