Comments (5)
Ok, I found a temporal solution. Using the custom turbo events, you can capture the submit-start
to load the progress-bar manually as follows:
<script>
document.addEventListener('turbo:submit-start', function () {
Turbo.navigator.delegate.adapter.showProgressBar();
});
</script>
from turbo.
@wnm try
import { Turbo } from "@hotwired/turbo-rails"
window.Turbo = Turbo // Turbo available throughout app
from turbo.
I'm having the same issue, it looks like you have to redirect AFTER handling the form-submission:
Turbo Drive handles form submissions in a manner similar to link clicks. The key difference is that form submissions can issue stateful requests using the HTTP POST method, while link clicks only ever issue stateless HTTP GET requests.
After a stateful request from a form submission, Turbo Drive expects the server to return an HTTP 303 redirect response, which it will then follow and use to navigate and update the page without reloading.
That doesn't work for me because I want to redirect the users to a different page, and that extra request is not ideal.
An option for me would be to disable Turbo on the actual form, but right now that's not possible, although there is an open PR for that #3
Hopefully that one will get merged soon 🤞
@coorasse please let me know if you find a workaround for this issue.
Cheers,
Jeff.
from turbo.
I posted on the Hotwire forums asking whether it should be default for the progress bar to always show on form submission. Otherwise, repeatedly rejected forms can appear as no-ops...
from turbo.
Ok, I found a temporal solution. Using the custom turbo events, you can capture the
submit-start
to load the progress-bar manually as follows:<script> document.addEventListener('turbo:submit-start', function () { Turbo.navigator.delegate.adapter.showProgressBar(); }); </script>
Is this still working for the latest version of Turbo? I'm loading Turbo via the hotwire-rails gem (and via the asset pipeline) and I get a Turbo is not defined
error....
from turbo.
Related Issues (20)
- Make turbo progress bar optional HOT 1
- Redirect after form success HOT 1
- Adding SVG subelements via Turbo Streams leads to them not being rendered HOT 2
- Stimulus does not always disconnect and reconnect when morphing HOT 1
- [Breaking changes] Turbo 8: Scroll position is lost on render when an ID is duplicated in the page
- Not working when a "." is in the path. HOT 1
- Morph action for streams not part of 8.0.4 but in docs HOT 1
- attribute that will cancel the page request on hover HOT 1
- turbo didn't get noticed of new content
- Head merge issue with turbo frame navigation promoted to a page visit HOT 4
- Custom rendering issue when clicking browser back button
- Turbo Morph with Dialog causes issues HOT 1
- Turbo frame history not navigating properly w/ back button after upgrading from 7 to 8 HOT 1
- Turbo.setConfirmMethod is not working HOT 1
- Proposal: Adding `Turbo.confirm` for programmatic confirmation dialogs HOT 3
- Turbo does not cancel pending requests that were prefetched on consecutive link clicks
- button with `popovertarget` not triggering in form (Safari 17)
- Turbo from not triggered when using submit button with form attribute HOT 6
- How execute js code in rails 7 'create.turbo_stream.erb' file HOT 3
- Blurred input refocusing when turbo replaces blurred input HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbo.