Hi all,
I have a single checkbox form that I’m trying to submit, which will then call the Update action of my controller, which in turn will call a Turbostream.
It’s been working fine — except, as I discovered recently after deploying, in Safari desktop, Safari mobile, and (strangely enough) Chrome on my iPad. They do DO NOT submit the form when the checkbox is changed.
Here is the simple code (which also calls an unrelated Stimulus action):
<%= form.check_box :completed, onchange: "this.form.requestSubmit()", data:{ action: "change->count-checked-checkboxes#count}, class:”blah”, style:”blah” %>
I came across a bunch of posts here (some from as far back as Dec 20), which talked about using requestSubmit (as I’m using), but that it didn’t support Safari. A workaround was using “ form-request-submit-polyfill ”, and that workaround was in fact incorporated in Turbo 7.1 in mid-November 2021.
MY QUESTIONS
-
I started my app about a week after ‘ form-request-submit-polyfill ’ was added to Turbo 7.1, and now I’m wondering if I don’t have the latest updates. My app is on Rails 6.1, and used the ‘Hotwire-rails’ gem (since deprecated) to get all the Hotwire libraries. I updated that gem recently, and that also upgraded a ‘turbo-rails’ dependency to 1.0.1 (was 0.5.12). Is there anything else I need to upgrade to get the polypill solution that was built into Turbo 7.1, or is that something limited to Rails 7?
-
As an alternative, I’m not sure how to implement ‘ form-request-submit-polyfill ’ in my existing Rails 6.1 app. This issue was the first time I ever heard of a “polyfill” and while I found a lot of people talking about it, I couldn’t find any examples of how to actually implement it.
Any guidance appreciated, thanks very much!