Tagged Questions
0
votes
0answers
6 views
How to execute JavaScript after cocoon has loaded a new nested form in Rails?
I'd like to set some fields hidden until a user clicks on a checkbox, then they're supposed to show up and it works fine with the first load like so
$(document).ready(function(){
...
0
votes
1answer
23 views
Change CSS for each item in Rails each method
So my each method works, but I am trying to add some code to make the dice change to its color that it is given. I am using rails and jquery/javascript. I just want to print the "dice type" and have ...
-1
votes
0answers
12 views
rails 4 jquery autocomplete with devise
I've been researching the rails-4 autocomplete gem and I've been struggling trying to understand one line given in the installation. The author states that I need to add the autocomplete as following ...
0
votes
1answer
12 views
Rails: Update database based on DOM element / jQuery
I am new to Rails and working on a quiz application, and am having trouble implementing the timer properly. When a user creates a new quiz, the controller calculates the time they are given based on ...
0
votes
1answer
30 views
Jquery not working in Coffeescript function Rails
I'm new to coffee script, so forgive me if this is a simple problem.
I'm trying to make a simple class change when a specific view is loaded in Rails. Specifically I want to run:
...
0
votes
1answer
22 views
Setting a value of a text field from a 2D array depending on the option of a dropdown menu
I have a dropdown menu providing options for the USA states.
The array of the states is declared into the controller, in this form:
@us_states = [
['Alabama', 'AL'],
['Alaska', ...
0
votes
0answers
12 views
Persistance for Multipage Form with Custom CSS Radio Buttons
I'm using the tutorial from tutsplus on custom CSS radio buttons. I append a class to the label when selected, and have a different background.
<label class="radio selected">
<input ...
0
votes
1answer
12 views
Rails escape_javascript and remotipart
When replacing html with jquery and rails (tested on 4.0.4) the following works:
Content of replace.js.erb
$('#my_div').html("<%= j(render 'my_partial') %>");
Content of _my_partial.html.erb
...
0
votes
1answer
17 views
rails 3.2: confirm delete. In development confim dialogs opens once, but in production it opens three times
I have a rails form that includes some links to delete sub-objects via remote. These links have a confirm option. In development, this works fine. However, in production when I click on the delete ...
0
votes
2answers
63 views
Rails 3, rendering partial view through ajax
I'm making an e-mail service with mailboxer gem.
In my index view I have several links that will lead to inbox/draft... like this:
<%= link_to "Inbox", show_conversations_path, :remote => true ...
0
votes
1answer
15 views
Rails/jQuery prevent form submission
jQUery prevent form submission.
$('#edit_user_form').submit(function(){
$("textarea[name = user_form_snippet]").enabled = enabled;
return false;
e.preventDefault();
});
...
1
vote
3answers
29 views
How do I capture rails form id in jQUery
The below is my form which is getting generated. Before my submit action is performed, I need to something in jQuery.
<%form_for @user, :url => {action => "update", :id => @user.id} ...
0
votes
1answer
7 views
jquery-datatables-rails gem doesn't display correctly until page is refreshed
Environment: Ruby 2.0.0, Rails 4.1, Windows 8.1, Devise, jquery-datatables-rails 1.12.2. I am also running Acts-as-tenant, which is a wonderful multi-tenant gem.
I have the datatables gem up and ...
0
votes
1answer
40 views
On Button Click Send Javascript Array To Rails Controller Via Ajax Request
Thanks for the help in advance, this one has stumped me for a few days.
I have a view in my rails app that will randomize a word in spanish while presenting the same word in english. Example:
dog
...
0
votes
0answers
11 views
Set Programmatic URL Dropzone Rails
I'm using dropzone-rails to add dropzone to my Rails app. I'm using CarrierWave for image uploads which is working fine without Dropzone.
I'm creating my dropzone programatically. The Dropzone seems ...
1
vote
0answers
28 views
Jquery Mobile - Refresh results in a blank/white screen everytime
So, I'm pretty new with JQuery Mobile. I got my web site mostly working, but I've hit a weird bug that rears its ugly head only sparingly and I can't seem to get any traction on it. This bug mainly ...
0
votes
1answer
18 views
Not able to match existing route path and getting 404 Not Found
I have following html markup where the action is one of the route path defined in sammyjs routing code:
<form id="loginform" action="#/login" method="post" class="form-horizontal">
<!-- ...
0
votes
1answer
18 views
Jquery, Rails: Prevent a user from opening multiple inline forms on a page at once?
I have multiple inline forms on a page that can be toggled. The page is specific to a given 'question' a user can submit, and other users can submit an 'answer', which is a form that can be toggled. ...
0
votes
1answer
32 views
How to interact with a javascript element
I am using ace editor (via jquery-ace-rails gem) to turn a textarea into a code editor.
<textarea class="my-code-area" rows="4" style="width: 100%">puts 'foo'</textarea>
<script>
...
0
votes
0answers
18 views
Rails 4 Cant connect to the java script files
I was working in a Rails app , and i am using a gem called cocoon and it mainly uses java script, it worked fine and everything was good , until I pulled a branch (git pull) of one of my team members ...
0
votes
1answer
33 views
Rails Routes And AJAX Requests
I'm completely stuck right now and could really use some help.
Here is what I'm trying to do. I'm using Ruby on Rails and I have two models. One is Exercises and one is Routines. A Routine is made up ...
1
vote
0answers
15 views
Owl Carousel dissapears after initial load without a refresh
I am using the Owl Carousel and for the most part it is working exactly as I had hoped. However, after loading on my main page, if I navigate away from the page and then return (via a link) or even if ...
0
votes
1answer
22 views
Rails 4 Bootstrap 3 Devise Login Modal
I'm trying to set up a modal so when a user clicks login or signup a pop over modal will appear allowing them to sign in through devise or fb/twitter.
The app I'm working with is using devise, ...
0
votes
1answer
27 views
check_box_tag checked state for the first element
I have a form_tag in which I display a table, one column of that table it has a check_box_tag
<%@competitors.each do |competitor|%>
<td><%= check_box_tag "competitor_ids[]", ...
0
votes
1answer
38 views
Rails Date Format in edit view
I'm creating Edit form in rails using partial for new and edit
I'm using date picker jquery so user can choose date with jquery-ui
my problem is how do I format all my date fields
because in edit ...
0
votes
2answers
51 views
Passing data from Javascript to HTML in real-time?
I'm tired and lost. It seems that a huge part of the challenge of coding in a disjointed MVC / multi-language fashion is figuring out ways to pass values between different parts at the appropriate ...
0
votes
0answers
26 views
Show/hide of Form + Toggle link text; ActionView::Template::Error (undefined method `id' for nil:NilClass) - thinks model instance is nil?
I'm trying to toggle link text upon showing and hiding a form, but when I run the server I get a 500 internal server error. I'm trying to add a "solution" to an "aspect", and render the solution form ...
0
votes
0answers
43 views
How to execute javascript in the background?
I am new to javascript, so pls pardon me if the question is too naive.
I am trying to run javascript from my rails app. The javascript is placed in a view file, which opens a cart popup. I have ...
0
votes
1answer
25 views
Dropzone File Upload Rails - Getting Started
This is probably a super dumb question but I'm trying to get Dropzone Image Upload rails gem working and I'm not sure what to do next.
https://github.com/ncuesta/dropzonejs-rails
I've followed the ...
2
votes
2answers
55 views
Where to put page-specific jQuery code in Rails 4.1?
I want to put some simple JavaScript code that uses jQuery on a particular page in a Rails 4.1 project:
$( "#my_div" ).on( "click", function() {
alert( $( this ).text() );
});
However, with Rails ...
0
votes
1answer
27 views
Div clickable in Rails with jQuery?
I have a div in one of my Rails views that I would like to make fully clickable:
<% @objects.each do |f| %>
<div class="overlay" >
<%= link_to image_tag("play.png"), f %>
...
0
votes
1answer
47 views
jQuery update slider's value on text field change
I'm developing a rails project that updates the slider's value to that of the text-field on any-change (probably keydown or change event).
My _form.html.erb file:
<div id="my-slider" ...
1
vote
2answers
28 views
Button to toggle text field, true and false
I have a form to create a true/false question. I am trying to have a button to toggle the value of a text_field from true and false. (I really do not care what way it is done, I just want the user to ...
0
votes
1answer
19 views
From js.erb file function call
I want a function in abc.js.erb like this:
function add_times(s){
<%num = 0%>
if(s == "Twice"){
<%num = 2%>
}else if(s == "Three times"){
<%num = 3%>
...
0
votes
0answers
36 views
Add input textbox into ruby form dynamically through jquery and store that values
Hi every one i am new to rub on rails. I have a ruby form, what ever the value on that storing correctly on db. But if i add new text box dynamically through jquery that value is not adding into db. ...
0
votes
1answer
74 views
+50
IE click event troubles
I have such page
http://автопортал-юга.рф/organizations/all_organizations/1
and in all browser's all is ok, when i click on link "подробнее" - i see ajax data appended to page view... But why IE ...
-1
votes
0answers
24 views
Jquery & prototype conflict because of jquery loading from advertisements
We are using prototype js in our Rails application.
$ in prototype has different meaning.
Since jQuery is loading from the advertisements, we are having conflicts.
jQuery resets the $ variable. ...
2
votes
1answer
28 views
Save HTML table to CSV, then send to server and save it
I have an HTML table that I want to save as a CSV on my server when a button is clicked.
How can I do this?
Overview:
Take HTML table and convert it to a CSV (Javascript).
Send CSV to server ...
0
votes
0answers
21 views
Navigating to pages in rails app makes multiple requests to different pages
I have two pages, a landing page and a profile page.
Here are the relevant parts of rake routes:
index GET /welcome/index(.:format) welcome#index
show GET ...
0
votes
1answer
26 views
Implementing AJAX call on checkbox in Rails to update db
Rails newbie here.
I am trying to make a checkbox called "Active" that will act as a form when the checkbox is checked/unchecked and use AJAX to automatically update the database with the changed ...
0
votes
1answer
25 views
Unable to delete object in Rails using Ajax
Noob here trying to create a simple note submit and delete app in Rails 4. I'm using Ajax to submit/delete, but cannot figure out why my object won't delete.
My Controller includes the following ...
0
votes
1answer
24 views
Form select option to change what gets rendered
Ruby on Rails 4 form with a drop down selection. If Multiple Choice is selected I want to render a page. If True/False is selected I want to render a different page.
I do not know why this isn't ...
0
votes
0answers
38 views
Rails replace div with escaped html. <img> src not working
I have a form that is sending a remote ajax request which is responding with update.js.erb
update.js.erb
$('#developers').html('<%= escape_javascript(render(:partial => "developers")) %>')
...
0
votes
1answer
30 views
Toggling HTML Link Text 'show/hide' to show/hide inline form for comment; create unique identifier so that not all comment links change on page?
In my app, I have a model 'comments' which can be submitted to a question, answer, solution or another comment.
Problem is, because the form is a partial and the app uses a Jquery toggle to show/hide ...
-1
votes
0answers
22 views
How to achieve mongoid search using multiple ajax calls
I am working on Rails4 and latest mongoid for the app.
Now i wanted to achieve main search as following,
For single category ex: "Professionals" i can call ajax directly and do the search. But in ...
0
votes
1answer
14 views
Fancybox video highlight with nothing in rails
I need to play videos in fancybox.
As per this solution
I started working
My a href tag looks like
<a class="fancybox" href="/uploads/ckeditor/attachments/55/myvideo.mp4">
<img ...
0
votes
0answers
25 views
JQuery POST Data to Rails DB
Following the tutorial here, I have created a Rails project, and uploaded it to Heroku. It is a DB that takes in scores for a highscore db, and lists them in a json file. I am able to upload a score ...
0
votes
1answer
21 views
bootstrap navbar links not clickable once uncollapsed Rails
http://boiling-garden-2168.herokuapp.com open the link, when the window is small enough so the navbar collapses, and you click the icon-bar to uncollapse it, only my drop down and feedback link are ...
0
votes
1answer
12 views
Rails link_to ignoring e.preventDefault(); from a jQuery call because method: :get is set
Experimentally I've learned that the following code:
<td><%= link_to 'Notify', '/w/'+w.id+'/notify', method: :get, :class => "btn btn-success notify-btn" %></td>
Fires ...
0
votes
1answer
27 views
Fade In Effect with Jquery and Rails
I am new to jQuery and I want to apply a fade in effect to an item being created in my rails application. The object appends to the DOM but the fade effect doesn't seem to work! This seems like it ...