Code Monkey home page Code Monkey logo

Comments (9)

timonweb avatar timonweb commented on August 23, 2024 2

@boardfish @dhh moved data-turbo="false" to the form tag and it works great now, thanks!

from turbo.

boardfish avatar boardfish commented on August 23, 2024 1

Upgraded to the new beta and the issue remains, unfortunately.

from turbo.

dhh avatar dhh commented on August 23, 2024 1

It's not the button that needs data-turbo="false", it's the form that button belongs to.

from turbo.

sstephenson avatar sstephenson commented on August 23, 2024

We just released 7.0.0-beta.2 which allows you to opt out of form submissions with data-turbo="false".

from turbo.

boardfish avatar boardfish commented on August 23, 2024

Testing this now for my use case. I'll close if it rectifies my issue.

from turbo.

timonweb avatar timonweb commented on August 23, 2024

@boardfish same here. Updated my button code to:

<button data-turbo="false" type="submit" name="subscribe" class="button is-medium is-black is-outlined is-fullwidth">Subscribe 🚀</button>

And it doesn't work, here's the console.error I'm getting:

28F17DB4-FC54-463F-9221-B77B322AFDCA

from turbo.

boardfish avatar boardfish commented on August 23, 2024

That's correct for buttons, but the link in the OP doesn't have a surrounding form. The data-method attribute controls the request method. I think this particular case is using fetch regardless of whether Turbo is enabled or not.

from turbo.

dhh avatar dhh commented on August 23, 2024

Ah yeah, then that's a bug. Turbo shouldn't be dealing with links that have data-turbo=false. cc @sstephenson

from turbo.

boardfish avatar boardfish commented on August 23, 2024

@timonweb Your button should look like this:

<form data-turbo="false" method="post" action="/subscribe">
  <input class="button is-medium is-black is-outlined is-fullwidth" name="subscribe" type="submit" value="Subscribe 🚀">
</form>

If you're on Rails, use a form helper:

    <%= button_to 'Subscribe 🚀', '/subscribe', class: 'button is-medium is-black is-outlined is-fullwidth',  name: 'subscribe', form: { 'data-turbo': false } %>

Hope that helps!

from turbo.

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.