Giter Site home page Giter Site logo

Comments (24)

jorgemanrubia avatar jorgemanrubia commented on July 20, 2024 46

I can confirm Turbolinks 6 will handle form submissions in a way that makes this unnecessary, among many other goodies 😀

from turbolinks-rails.

jorgemanrubia avatar jorgemanrubia commented on July 20, 2024 24

@MrHubble I am not working on Turbolinks 6. @sstephenson and @javan are. It will introduce a bunch of new features that, among other things, will solve the problem this gem addressed. It will use a different approach compared to the gem, so it should not affect to your decision of using the gem now (it won't make adopting it harder or easier).

Sorry I can't share more details yet. Hopefully we'll have exciting news about the new version next year. I attended an internal presentation and all I can say is that it's going to be huge.

from turbolinks-rails.

roelandmoors avatar roelandmoors commented on July 20, 2024 13

I'm a new Rails user and I was really confused with forms not just working. At first nothing was working because a xhr request occurred and I didn't know I should handle it. I then handled it with custom javascript to only replace the form, but error handling was not working correctly.
I then installed this Gem and now it works as I hoped it would the first time.

I really hope a solution like this will go into Rails/Turbolinks by default.

from turbolinks-rails.

jorgemanrubia avatar jorgemanrubia commented on July 20, 2024 8

Support for form validations is totally in the plans. There is a PR here with a proposed solution. We discussed this internally before releasing Hotwire and, while it was left out for launch, we agreed this was necessary as it's a common Rails pattern.

from turbolinks-rails.

xiobot avatar xiobot commented on July 20, 2024 7

Please let's have this in core!

from turbolinks-rails.

MrHubble avatar MrHubble commented on July 20, 2024 5

I believe @sstephenson and @javan suggested this might be included in Turbolinks 6 on the Remote Ruby podcast:

They each share how they got started programming, a brief insight into how they work at Basecamp, the transition from CoffeeScript to ES6, Typescript, as well as (wait for it...) upcoming features in Stimulus (🙌) and considerations for Turbolinks 6 (no feature promises made 😉).

from turbolinks-rails.

mrhead avatar mrhead commented on July 20, 2024 4

Nice work @jorgemanrubia! I agree, that this (or something similar) should be enabled in Rails by default so default remote forms don't need any custom SJR. And if they need it, then Turbolinks can be disabled for the action and custom SJR can be returned.

from turbolinks-rails.

jorgemanrubia avatar jorgemanrubia commented on July 20, 2024 4

@sstephenson @rafaelfranca could you please weight in on this one? I am really good with any decision, I just suspect this hasn't even entered into your radar yet.

In addition to my comment above, I wrote a couple of pieces on why I think this should be officially supported by Rails:

The library got much better on latest iterations but I know there are probably additional scenarios to handle. As mentioned above, I'd love to put the work to make this happen.

Thanks!

from turbolinks-rails.

jorgemanrubia avatar jorgemanrubia commented on July 20, 2024 3

Thanks @MrHubble, that's great news. I haven't been able to get any kind of response on this one despite of trying different channels so I'll grasp at this 🤷🏽‍♂️.

from turbolinks-rails.

dsazup avatar dsazup commented on July 20, 2024 3

I can confirm Turbolinks 6 will handle form submissions in a way that makes this unnecessary, among many other goodies 😀

Hey @jorgemanrubia, now that hotwire is out, do you think this is still relevant? It seems the gem you have created and hotwire works a bit different. Your gem replaces the whole page and is very automatic, whereas hotwire requires to add respond_to turbo_stream for every form and it creates a lot of work. I still think it would be really great to have something like this in the core (or maybe v2 of your gem 😄 )

from turbolinks-rails.

jorgemanrubia avatar jorgemanrubia commented on July 20, 2024 3

This is handled now in latest turbo beta. Kudos to @seanpdoyle for tackling this!

from turbolinks-rails.

bdavidxyz avatar bdavidxyz commented on July 20, 2024 3

@jorgemanrubia @seanpdoyle It actually works only for the error scenario. For the happy path, if the form submission simply render something, it doesn't (yet) works.
Scenario where you do some in-place editing (so you POST some data, but stay on the same page with some valid feeback displayed) are actually pretty common.
How to handle this right now ?

from turbolinks-rails.

jbakerdev avatar jbakerdev commented on July 20, 2024 2

@sstephenson @rafaelfranca - Another vote to include in core. Sure seems like the missing link...

from turbolinks-rails.

manuelmeurer avatar manuelmeurer commented on July 20, 2024 1

@amitsaxena Unfortunately you're right, there is not much info on when the next version of Turbolinks will be available.
There is a thread about it on the Rails discussion forum: https://discuss.rubyonrails.org/t/turbolinks-and-stimulus-are-developed-behind-a-wall/75124

It would be so nice if the defaults for forms were fixed and the rails guides gave examples of how to build forms in a rails app.

The Rails guides are open-source and everyone can contribute! If you can't find something that you think should be in there, consider adding it:
https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation

from turbolinks-rails.

thelucid avatar thelucid commented on July 20, 2024

Any news on this?

from turbolinks-rails.

thelucid avatar thelucid commented on July 20, 2024

@jorgemanrubia This looks great! We need this in rails core, or something similar. My only addition would be to allow the scroll position reset to be optionally disabled as this can sometimes be useful on a search results page; so that you can do dynamic filtering etc.

from turbolinks-rails.

manuelmeurer avatar manuelmeurer commented on July 20, 2024

Ping @sstephenson @rafaelfranca, it would be really great to hear the Turbolinks team official stance on this! 😄

from turbolinks-rails.

ahoward avatar ahoward commented on July 20, 2024

yes. js in rails needs to work or all-js starts feeling better ;-/

from turbolinks-rails.

MrHubble avatar MrHubble commented on July 20, 2024

@jorgemanrubia that's great news! Is this something you're personally working on at Basecamp?

For someone who has yet to tackle this problem, would you recommend using your turbolinks-render gem or wait for Turbolinks 6 to be released? The main concerns are ease of migrating from turbolinks_render to use Turbolinks 6, and the unknowns around a potential release date for Turbolinks 6.

from turbolinks-rails.

amitsaxena avatar amitsaxena commented on July 20, 2024

@jorgemanrubia I guess no movement on this or Turbolinks 6 even after more than an year? What's the recommended way to handle remote forms these days? 😄

from turbolinks-rails.

jorgemanrubia avatar jorgemanrubia commented on July 20, 2024

My recommendation would still be turbolinks-rails until Turbolinks 6 is released. I know it's taking a long time. Hadn't being this year so crazy it would be already out.

from turbolinks-rails.

amitsaxena avatar amitsaxena commented on July 20, 2024

Creating simple forms in a fresh rails 6 app is a pain these days. I miss the golden convention our configuration days when it was so simple to keep moving 😄

For some reason redirect_to now no longer works for my turbolinks forms (though it seems to work in a fresh app). The logs say Redirected to xyz but no real redirect happens. Not sure what's happening. Also relying on redirect for ajax requests seems fragile to me given what if future versions of rails just broke this behaviour (not sure if redirect_to works across all remote requests even now). Other people seemingly are complaining about rails forms as well:
https://discuss.rubyonrails.org/t/default-handling-of-remote-forms/74680

It would be so nice if the defaults for forms were fixed and the rails guides gave examples of how to build forms in a rails app. The current information is scattered and incomplete. Or have we just assumed that everyone is using SPAs these days. The barrier to entry for a newcomer seems significant as of now and I am not sure if that's helpful for growing the community.

from turbolinks-rails.

amitsaxena avatar amitsaxena commented on July 20, 2024

Additionally I have no idea where turbolinks 6 is (there is no branch with that name and I don't see a turbolinks-next either) and if it is being worked upon. So I have no idea if it's coming in 2020 or 2025 🤔

I guess I'll go with local: true for now (default rails scaffolds seem to be using that hack as well instead of doing it the recommended rails way) to move forward.

from turbolinks-rails.

leastbad avatar leastbad commented on July 20, 2024

I had two hopes for Hotwire: that it would fix remote form validations and provide a viable Android wrapper. I am grateful for the Android wrapper, don't doubt for a moment.

I created Optimism to handle validations for remote UJS forms. I was really excited to sunset the library, because it shouldn't need to exist.

You're our human on the inside. Please, we're counting on you!

from turbolinks-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.