Skip to main content

Questions tagged [ujs]

UJS is an unobtrustive JavaScript adapter for jQuery, provided by the Ruby on Rails project. For questions about unobtrustive JavaScript in general, please see the [unobtrustive-javascript] tag.

0 votes
0 answers
27 views

Rails UJS Remote Form Only Evaluates JS for 2XX Responses but Not 4XX Responses

Was there a change in how JQuery 3 and Jquery 1 handled remote form errors on Rails? In the past, (Rails 6, Zurb Foundation, Jquery 1), the code below would work. A user would submit a form, they'd ...
Patrick Jones's user avatar
0 votes
0 answers
49 views

Where am I loading jquery_ujs in my Rails 6 app?

Bugsnag is reporting this error on many pages: "If you load both jquery_ujs and rails-ujs, use rails-ujs only" Rails 6.1.3, with webpacker. application.js: // //= require rails-ujs //= ...
Ashton's user avatar
  • 9
0 votes
1 answer
28 views

Rails UJS cannot render image_pack_tag

It looks trivial, but rails cannot parse this .js.erb file properly: $('.username-content').fadeOut('slow', function() { var div = $("\ <div class='username-content'>\ <%= t('...
Seto's user avatar
  • 1,452
0 votes
1 answer
1k views

Upgrading from Rails 6 to 7: jquery-ujs and actioncable not working

I've just upgraded my Rails 6 app to Rails 7, and now my Javascript and ActionCable aren't working. After a bit of googling, I now know that this is because my app is set up to use sprockets with the ...
Harry Mattocks's user avatar
0 votes
0 answers
109 views

$ is not defined error in production environment Rails 5.1.7

jQuery and ujs work fine in the development environment, but are not working in production environment. This is what my code looks like: application.html.erb <html> <head> <%= ...
Sheriff Hussain's user avatar
1 vote
1 answer
2k views

Stimulus ajax:response not returning the server response data

I am starting a new Rails 7 app and recently found out that we can't use ujs anymore :( I found a plugin called mrujs which is working correctly to send my forms remotely to the server. I am also ...
Eric Reynolds's user avatar
3 votes
0 answers
2k views

How to set up Rails UJS along with Turbo?

I'm confused as to exactly what I need to do to run my old jQuery snippets and Rails UJS along with Turbo. DHH added this PR in June that was supposed to improve compatibility, but it lacks details on ...
dwayne's user avatar
  • 128
0 votes
1 answer
52 views

Rails ujs response not hitting target

The following view has a div for receiving a rails ujs action result <div class='grid-x grid-padding-x'> <div class='cell small-12 text-center'> <div id="afamilis"> ...
Jerome's user avatar
  • 6,011
1 vote
2 answers
577 views

Upgrading to rails 5.2 - remote forms now refreshing the page

I am trying to upgrade a Rails 5.1.7 application to 5.2.0. Some forms on the site were broken by the upgrade. The template for the form looks like this: <%= form_with model: record, url: ...
Daniel Littlewood's user avatar
0 votes
0 answers
231 views

Rails UJS not submitting form when submit button pressed

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 ...
Jack R-G's user avatar
  • 1,876
0 votes
1 answer
384 views

How to make work of ajax on rails forms and how to get validation errors from server?

I am trying to apply this rails tutorial to my project. I made create action works. I added some validation to my model file. Now, problem comes here. When i submit entry form, rails must give errors. ...
Sercan Tırnavalı's user avatar
0 votes
0 answers
61 views

Rails Realtime Chat: Is it secure to implement it with just plain javascript?

I've added a realtime chat to my rails application using only vanilla javascript. I've included it below. I'm just wondering, are there any security issues just looking at the code I've provided? I'm ...
cozimo's user avatar
  • 105
1 vote
1 answer
407 views

Rails Ajax event on replaced DOM element

I have a simple Rails ujs app, with some remote links on the page. <%= link_to 'Test', posts_path, remote: true, id: 'test' %> In my js template, I replace this link with new one. $('#test')....
Molfar's user avatar
  • 1,451
1 vote
2 answers
1k views

How to access ruby instance variable in Javascript through HAML template

I have a partial that is being rendered with the CommentsController. Lets call this partial _edit_comment.html.haml where I'm passing in the instance variable @comment. $("#edit-comment-#{object....
Nigel's user avatar
  • 997
1 vote
2 answers
1k views

Rails 6 + UJS: make ajax call on blur without jQuery

I have a form with two input text fields. The datalist for the second field needs to be populated when the first field has a value. I have everything working as I want except I can't work out how to ...
SteveRawlinson's user avatar

15 30 50 per page
1
2 3 4 5
19