similar to: using inline insert_html to generate uniquely named elements

Displaying 20 results from an estimated 1000 matches similar to: "using inline insert_html to generate uniquely named elements"

2006 Jul 05
0
Javascript repeating fields.
The one area I keep hitting my head against in Rails is repeating fields via javascript. I frequently have forms where one or more fields are actually broken out into sub tables because there can be multiple simultaneous values. Rails seems to want to you to use the [] construct in the form helpers (e.g. text_field(''employee[]'', ''name'')), but I can''t
2006 May 13
2
Using RJS in views without ajax
Hi! I can use RJS in views like this (without using ajax): <%=link_to_function("switch fields", update_page do |page| page.insert_html :before, ''date'', date_select(''exhibition'', ''date'') page.remove ''date'' end) %> Is there a way to move this RJS code into a function to separate file? .js files are not parsed
2006 Jun 27
4
RJS Form Values
Hi, I have the following code : <%=link_to_function("? | China", update_page{|page| page[''tags_en''].value = "China" page[''tags_ch''].value = "?" }) %> This updates two text fields with the China and ?. However I want to append the values, not replace them. So I need something like this :
2009 Aug 23
0
Best way of moving some jQuery from a view helper
I have a helper that uses some jQuery code that I would like to move out of the helper method. I am trying to move it to application.js but it will probably end up in a different file. I have two reasons for wanting to do this. 1) I want to keep all my jQuery code seperate to my HTML code 2) I want to change the append to an appendTo so I can add a highlight effect, appendTo which is proving
2007 May 07
0
page.insert_html
Hi everyone, In one of the actions i am using page.insert_html, t works fine in IE7 and Mozila. Is does not seem to work in IE6. Anyone aware of such problems... i''m stuck... any help is appreciated; the element i am inserting into is a <td> page.insert_html :after, ''company''+params[:id].to_s, :partial =>"group", :id => params[:id] and the aprtia
2008 Apr 23
0
Passing a hidden field to insert_html
I''m trying to pass a hidden field (item_property) to the add_link helper function but when I do it the process threads start eating up memory and my computer freezes. [code=helper.rb] def add_link(name) link_to_function name do |page| page.insert_html :bottom,:partial, :partial => ''item'', :object => Item.new(:item_property => "Some text")
2009 Jun 29
0
Problem with 2.3 nested forms and new elements
Hi, I''m using the new nested forms functionality and I having problems with new created elements. I have an invoice with lines. I would like to be able to create a new invoice, in the same form insert new lines dinamically and saving the invoice and the lines when everything is validated, not before. The problem is that when I add a line dinamically to the form, the new line created
2007 Dec 20
3
How-to spec this helper method?...
Hey gang, I have this dead-simple method defined in a helper: def add_category_link(name) link_to_function name do |page| page.insert_html :bottom, :categories, :partial => ''category'', :object => Category.new end end Where, and mostly how, would I spec this? I haven''t been able to find how to stub the rjs in a helper spec, so
2006 Mar 03
1
rjs isn''t update_page problems
i have a list of, for example, meal_names. Basically, I can submit a name and the name I add shows up in the list.I had this working wehn i created an actual add.rjs template for it. So feeling good about my self, I attempted to move it all to the controller and use some update_page goodness. Now it the ajax middle doesn''t happen. I don''t get any errors but the list
2006 Mar 03
0
re: rjs update_page problems
my apologies for my previous butchery of the english language... i have a list of, for example, meal_names. Basically, I can submit a name and the name I add shows up in the list.I had this working when i created an actual add.rjs template for it. So, feeling good about my self, I attempted to move it all to the controller and use some update_page goodness. Now the ajaxy magic doesn''t
2007 Dec 06
0
Stange behaviour with internet explorer
Hi! I''m developing an application with Rails 1.2.6 and I''ve facing a weird problem. In a form, I''m using link_to_function that is aggregating a :partial, the code is as follows: <table> <thead> <tr> <th>Marca</th> <th>Porcentaje</th> <th>Objetivo Mensual</th>
2006 Apr 18
4
update_page yields escaped code in callback
Hi All, The subject pretty well describes what I am experiencing. This line in an .rhtml template: <%= link_to_remote menu_item.humanize, {:update => ''section'', :url =>{:controller => menu_item}, :complete => update_page do |page| page.activate_tab("#{menu_item}_tab", ''menu_'') page[''section''].hide
2006 May 28
1
RJS template / page.insert_html problem
Hiall, I have a rjs template which is calling page[:xxx].replace_html ... a couple of times and this works perfectly. However, in the same rjs file I have two calls to page.insert_html, which do not work. No error in development.log, nor error message in browser, the new content for the div simply isn''t changed at all. This is my code: ... action = "save_" +
2006 Jul 26
3
insert_html inserting fragment twice
Has anyone had trouble with inline RJS insert_html with the latest version of Rails? My problem is that insert_html inserts the html fragment twice. For example, render :update do |page| page.insert_html :top, "some_list", "<li>booyow</li>" end would render "<li>booyow</li>" twice. Thanks. -- Posted via
2009 Aug 07
2
calling a jQuery function from RJS/onclick
Hi, I have the following jQuery function on the head of my page. <script type="text/javascript"> jQuery.noConflict(); /* calling jNice on document ready */ jQuery(document).ready(function($) { $(''div.jNice'').jNice(); }); ..... </script> On page load, this gets called correctly. Now there''s a link on the page that lets me add more
2009 Mar 07
0
RJS: pass javascript variables in ruby calls
Hey, I have this link_to_function which takes an RJS block as follows: page.insert_html :bottom, :documents, :partial => "upload_fields", :locals => { :doc => Document.new, :index => ''UNIQUE_ID'' } It adds a partial to a div. I need index to be a unique id, but can''t generate one. I have an actual javascript function next_index() that will
2006 Mar 22
1
page.insert_html and the :text argument
Hi, I''ve got a problem with .rjs templates. When I do page.insert_html :bottom, ''stylist_tablebox'', :text => "what ever" This is what I get: new Insertion.Bottom(''stylist_tablebox'', null); I tried this on Edge rails revision 3860 in an inline rjs update. Thanks in advance, Frederik
2008 Jun 18
7
Object Task at episode 74 of railscasts
Hi. In the episode 74 <http://railscasts.com/episodes/74>, Ryan has a model "project" that can have many "tasks", and he uses link_to_function to dynamically add a field in the form for a new Task. In order to do that he created a helper called add_task_link. The code of the method is: # projects_helper.rb def add_task_link(name) link_to_function name do |page|
2006 Dec 17
0
unterminated string literal
Hello, I am not able to solve this problem on my own. I have a nested Div tag like this: <div id="training" > <div id="daytraining" >Training </div> </div> Some other elements should insert content here by: <%= content_tag("div" ,"Training",:id => "#{training.date.day}" , :onmouseover =>
2009 Jun 01
0
Nested models and forms
Hi, I have been trying to use the new nested models & forms feature in rails 2.3 #helper def add_job_profile_link(name, form, vacancy) link_to_function name do |page| profile = render(:partial => ''job_profile'', :locals => { :f => form, :job_profile => vacancy.job_profiles.build }) page << %{