0

I have a problem where, when I upgraded to Rails 5.1, one of my forms does not work. Specifically, if I click on the submit button, it gets disabled and the form does not submit. I think the issue is UJS, which was not present in my app in previous Rails releases. BTW, the "form" element is pure HTML (no Rails form helper) and the submit button uses "submit_tag".

So, this brings up two questions:

  1. How do I disable UJS in a given page or form.

  2. How do I troubleshoot this issue (or, in general, issues with UJS)?

And, of course, if you have the gift of sight and can tell me why my form is behaving this way, I would offer up a sacrifice in your name.

Jack R-G
  • 1,778
  • 2
  • 19
  • 25
  • 1
    UJS is disabled by default unless you use the special attributes like `data-method`, `data-remote`, `data-confirm`, `data-disable`, etc. that the rails helpers add AND you have the javascript included (check your application.js). You should show the form, at least the main
    tag and its attributes and the submit tag too.
    – arieljuod Feb 14 '21 at 20:55
  • 1
    How to debug it depends on what's the cause. If you can confirm it's UJS then you can put breakpoints inside the UJS code to see what's happening using the browser's dev tools. I would start making sure it's a UJS issue (you say the submit disables after clicking but you didn't have UJS before? how was it disabled then?) – arieljuod Feb 14 '21 at 20:58

0 Answers0