Mysterious blank form submissions in Rails 7, possibly Turbo-related?

With our upgrade to Rails 7, we thought we’d stick with the way the Rails community is going, and rewrote all our JS in Stimulus. With this transition, some of the preexisting forms have been misbehaving, and I suspect this has something to do with Turbo.

The main symptom is “blank” form submissions, where all the parameters are missing from the HTTP request. This happens even on forms that have default options preselected in the HTML, and where it ought to be impossible to submit the form without selecting anything. It happens inconsistently, and is rare enough that it is hard to debug, but frequent enough to be a problem for our users.

We’re trying disabling Turbo on affected forms to avoid the problem, but it would be good to get to the bottom of the problem, ideally so we can use Turbo properly across the site.

The “support” form here is an example case:

Our JS is pretty minimal and straightforward; we’ve relied mostly on a traditional server-side pattern hitherto, which is one reason why Stimulus is an appealing proposition.

Any thoughts much appreciated.

Seeing this behaviour as well on one of our old forms (remote: true etc) - actually ends up submitted it as an html format, and resulting in an UnknownFormat error in the controller. This has been happening since the upgrade to Rails 7, and like you said, albeit intermittently occuring as well (the worst kind of issue for something linked to a lead form!)

I noticed that you just updated it to Turbo form, but did this solve anything for you? @robjlucas

1 Like

Thanks @nickj. To be honest, I’ve lost track of where we got to with this issue. As far as I remember, we just left turbo: false on most forms, as we couldn’t trust Turbo with these things, and that solved it enough for us to get on with other things. But of course, that means we’re not using Turbo everywhere we could be.