similar to: Removing an element from an array

Displaying 20 results from an estimated 10000 matches similar to: "Removing an element from an array"

2007 Jul 06
0
Removing One Element From a Serialized Form
Hi all, I''m trying to serialize a form with the exception of one specific element. Serializing the form in a hash (without pulling out specific elements) works: <li> <%= link_to_remote ''(Save)'', {:url => post_path(@post), :with => "$ (''post_form'').serialize(true)" }, :method => :put %> </li> The generated code
2006 Aug 02
0
"RJS Error: TypeError: $(element) has no properties"
i have lots of divs, which are added via link_to_remote. now i want to delete them with a link_to_remote button for each. i am giving them ids with the same name and a serialized number. when trying to access them with javascript/rjs, strange things happen: "RJS Error: TypeError: $(element) has no properties?. is this a rails, rjs or prototype bug? or am i missing something? see my code
2006 Feb 28
2
AJAX: do render but show element in same click?
I''m a rails newbie. I''ve got a link_to_remote that puts a partial render into a div ("note1", "note2", etc.). As part of the display that comes up, I put in a hide note link (element.toggle). Click that, the div goes away, everything''s great... except now I can''t get it back. How can I call the remote AND make the div show at the same
2008 Jul 24
1
How to add link_to_remote element with RJS?
Hello, after executing an action, I add an <li> element to an existing list using a RJS template: page.insert_html :bottom, :contributors, "<li id=''contributor.#{@contributor.id}''>#{@contributor.user.name}</li>" but I need to add an image with a link_to_remote as I have in a partial page: <li id="contributor.<%= contributor.id
2006 Apr 07
3
RJS removing content of div, but not div itself
Hi, I''m creating a list of ingredients on a page. When the user clicks the ''Add Ingredient'' button a record gets added to the db and the ingredient gets added to the page. On the page, each record is represented by a <div> with three <span>s inside. One of the <span>s has a link_to_remote to ''delete'' the ingredient. When the link
2011 Sep 18
1
Removing a single element from an array
R 2.13.1 OS X Colleagues I frequently encounter a situation in which I want to remove a single element of an array. For example, if I am reading in a bunch of CSV files, I create the list of files to be read with: LIST <- dir() However, sometimes I want to exclude one or more files. I can accomplish this with a second command: LIST <- LIST[LIST != "filename.to.be.excluded"]
2006 Apr 17
2
Building Dynamic DOM Element IDs for RJS Templates
My element IDs are constructed using the object id. So . . . <div id="foo<%= foo.id %>" > <p><%= link_to_remote "Do Foo", :url =>{:action => "do", :id => foo.id} %> </div> How do, and can I, build that id in the RJS template? Also, can anyone recommend a good Ruby syntax book that would help me out with Rails? I know
2008 Jul 23
0
Link_to_remote object missing
Hello, I''m in troubles trying to use ''link_to_remote'' on Rails 2.1. Having this page: <h4>Editing project</h4> <% form_for(:project, :url => project_path(@project), :html => { :method => :put }) do |f| %> <p> Name <%= f.text_field :name %> Date <%= calendar_date_select :project, :target_date, :time =>
2006 Mar 28
1
Ajax callback to javascript array ?
I have some javascript, <script> var arrCustomers; function setCustomers(arr) { arrCustomers= arr; // arrCustomers holds now array of customers } </script> ... and Rails controller, class CustomersController < ApplicationController def list @customers = Customer.find_all end end ... and Ajaxed link to get the customers, <%= link_to_remote "Get
2006 Jan 10
5
using dynamic element ids with visual_effect
Mike and I demo an Ajaxified version of the Depot application in the Rails Studio. Part of the demo is a cart in the sidebar which updates when you add a product to it. As well as updating the div, it also highlights the most recently added link item. Right now, we do it with: <script language="JavaScript"> function flash_cart(request) { var id =
2009 Jul 11
6
conditional link_to_remote not re-rendering
I have an int, ''floorfrozen,'' in my table, ''channels'' that can take a value of 0 or 1. When I render a page, an image in a link_to_remote is called differently depending what the value of channel.floorfrozen is, in a partial, as follows: <% if @channel.floorfrozen %> <%= link_to_remote image_tag("/images/icecube.gif"), {:url =>
2006 Mar 13
2
How to apply an effect to a link_to_remote :update without using evaluate_remote_response?
Hey all, I''ve been trying to apply a slide-down (or highlight) effect to a "New card" link on my application. Because the item is *new* and I''m simply updating it at the top, I can''t know what the div id is before I make the request. link_to_remote :complete => visual_effect(:slidedown) doesn''t do what I want it to do. My current solution is:
2006 Apr 22
3
quick ''link_to_remote'' question
Hi all i''m using link_to_remote to render different sets of text-input fields. i''m setting up links in a sidebar to do this so, in my _sidebar.rhtml i have <%= SidebarItem(''catalogue'') %> this works...(in works.helper.rb) def SidebarItem(name) link_to_remote "#{name}", :update => ''EditFields'',
2005 Oct 28
1
Actionless self-referential views , logic in my views, yes, but less LOC. One draw back, it dont work.
<%= render (:partial => "collapsed_blog" , :locals => {:be => be , :hide => "yes"}) %> This above code is in a .rhtml page. Here is the partial it renders: <p class=<%="blog_content" + be.id.to_s%>> <% if hide == "yes" %> <%= be.blogshorttext %> <%= link_to_remote ('' [See Full Text ('' +
2006 May 17
0
send_data not working properly with link_remote_to
I''m reading an image in an link_to_remote call,and then using send_data i send the read image as :type => "image/png" :disposition => "inline"...but when the div tag gets updated i see only ascii characters .....but if i do the same operation using normal call(link_to) i see it functioning normal ....could someone explain . my view: <%=
2006 Jun 01
1
link_to_remote renders Ajax.Updater, sometimes Ajax.Request
I''m new to Rails, but am really enjoying working with it. But i just hit a brick wall... I have two link_to_remote tags in two seperate _whatever.rhtml files. The targets of the updates are in edit.rhtml which does a render :partial to include the links. here''s some code: <%= link_to_remote ''Destroy'', :update => "libtable",
2006 May 30
4
Hide parent element
I have some code that calls a partial to display one or more blocks within a div tag. I want to have a close button (or cancel link) that will fade that block but leave the others. Here is the code: LINK: <%= link_to_remote "Add Miscellaneous Link", :url => { :action => :add_iyc_link } %> add_iyc_link.rjs: page.insert_html :bottom, ''links'', :partial
2006 Jan 11
0
AJAX: link_to_remote problem
I use: <%= link_to_remote("Update", :update => ''mydiv'', :url => { :action => :create, :host => ''rails'' }) %> which generates the following: <a href="#" onclick="new Ajax.Updater(''mydiv'', ''/account/create'', {asynchronous:true, evalScripts:true}); return
2008 Jul 16
2
params for link_to_remote
Hello :-), i want to use ''link_to_remote'' to create a simple form on the website. The form is a simple editor to post a comment to an article. I need to know the article_id in the new view/controller. With ''render'' everything works fine, but ''link_to_remote'' doesnt work with :params :- ( here is my code of the article view: <div
2005 Aug 15
2
Newbie rendering problem
Hi On every list request i render an item partial through a collection of items. the item table has 3 columns namely name,anotherName and id. the item partial looks like <%@item=item%> <%= error_messages_for(:item) %> <tr id="<%=item.id%>"> <% for column in Item.content_columns %> <td><%=h item.send(column.name) %></td> <%