Victor Martin
2009-Jul-25 15:43 UTC
page.insert_html does not insert html with link_to_function
Hi there, The partial is like this: <p></p> <div id="group" class="elements"> <p></p> <%= link_to_function ''Add text field'' do |page| page.insert_html :bottom, :group, :partial => ''text'' end%> <g_title>Text Group #1</g_title> <%= render :partial => ''text'' %> </div> And the code of the insertion is like this: <%= link_to_function ''Add group'' do |page| page.insert_html :bottom, :groups, :partial => ''group'' end %> This way, it does not insert the partial. But, if I remove the "link_to_function", it does insert it! Any idea of this? :( -- Posted via http://www.ruby-forum.com/.
Jeffrey L. Taylor
2009-Jul-25 19:23 UTC
Re: page.insert_html does not insert html with link_to_function
Quoting Victor Martin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Hi there, > > The partial is like this: > > <p></p> > <div id="group" class="elements"> > <p></p> > <%= link_to_function ''Add text field'' do |page| > page.insert_html :bottom, :group, :partial => ''text'' > end%> > <g_title>Text Group #1</g_title> > <%= render :partial => ''text'' %> > </div> > > And the code of the insertion is like this: > > <%= link_to_function ''Add group'' do |page| > page.insert_html :bottom, :groups, :partial => ''group'' > end %> >RTFM. The proper syntax is <%= link_to_function(''Add text field'', nil) do |page| page.insert_html :bottom, :group, :partial => ''text'' end %>
Victor Martin
2009-Jul-25 22:34 UTC
Re: page.insert_html does not insert html with link_to_function
Jeffrey L. Taylor wrote:> RTFM. The proper syntax is > > <%= link_to_function(''Add text field'', nil) do |page| > page.insert_html :bottom, :group, :partial => ''text'' > end > %>Hi Jeffrey, that is not the problem (I tried it, anyway); in fact, that link_to_function (''Add text field'') works perfect. The ones that is not working is ''Add group''. It works just if I remove the ''Add text field'' link_to_function from the partial :/ Thanks anyway -- Posted via http://www.ruby-forum.com/.
Victor Martin
2009-Jul-28 10:14 UTC
Re: page.insert_html does not insert html with link_to_function
Nobody knows? I''m still stuck in this thing :( -- Posted via http://www.ruby-forum.com/.
Frederick Cheung
2009-Jul-28 10:34 UTC
Re: page.insert_html does not insert html with link_to_function
On Jul 28, 6:14 am, Victor Martin <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Nobody knows? I''m still stuck in this thing :(Have you tried using firebug to work out what is going on ?(eg is the partial that is inserted mangled in some way ?) Do also check that all the dom elements you think should exist are actually there and that dom IDs are unique. Fred> -- > Posted viahttp://www.ruby-forum.com/.
Victor Martin
2009-Jul-28 12:30 UTC
Re: page.insert_html does not insert html with link_to_function
Frederick Cheung wrote:> On Jul 28, 6:14�am, Victor Martin <rails-mailing-l...@andreas-s.net> > wrote: >> Nobody knows? I''m still stuck in this thing :( > > Have you tried using firebug to work out what is going on ?(eg is the > partial that is inserted mangled in some way ?) > Do also check that all the dom elements you think should exist are > actually there and that dom IDs are unique. > > FredHi Fred, I''ve got this error from firebug when I click on the "Add new group" link: "missing } after property list" But I don''t know what to do; I''m pretty newbie with this. It seems right to me, it is just the same as the other link_to_function. -- Posted via http://www.ruby-forum.com/.
Frederick Cheung
2009-Jul-28 13:20 UTC
Re: page.insert_html does not insert html with link_to_function
On Jul 28, 8:30 am, Victor Martin <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Frederick Cheung wrote: > > > Hi Fred, > > I''ve got this error from firebug when I click on the "Add new group" > link: > > "missing } after property list" > > But I don''t know what to do; I''m pretty newbie with this. It seems right > to me, it is just the same as the other link_to_function.That sounds like somehow some invalid javascript is getting generated. Fred> > -- > Posted viahttp://www.ruby-forum.com/.
Jeffrey L. Taylor
2009-Jul-28 15:48 UTC
Re: page.insert_html does not insert html with link_to_function
Quoting Victor Martin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Hi there, > > The partial is like this: > > <p></p> > <div id="group" class="elements"> > <p></p> > <%= link_to_function ''Add text field'' do |page| > page.insert_html :bottom, :group, :partial => ''text'' > end%> > <g_title>Text Group #1</g_title> > <%= render :partial => ''text'' %> > </div> > > And the code of the insertion is like this: > > <%= link_to_function ''Add group'' do |page| > page.insert_html :bottom, :groups, :partial => ''group'' > end %> > > This way, it does not insert the partial. But, if I remove the > "link_to_function", it does insert it!I am confused. Is the ''group'' partial the first bit of code? And the second piece of code calls it? And what is the contents of the text partial? Jeffrey
Victor Martin
2009-Jul-28 16:25 UTC
Re: page.insert_html does not insert html with link_to_function
Jeffrey L. Taylor wrote:> Quoting Victor Martin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> end%> >> This way, it does not insert the partial. But, if I remove the >> "link_to_function", it does insert it! > > I am confused. Is the ''group'' partial the first bit of code? And the > second > piece of code calls it? And what is the contents of the text partial? > > Jeffrey_text is like this: <% options = {''Normal text'' => ''normal'', ''Highlighted text'' => ''highlighted'', ''Notes'' => ''notes''} %> <div class=''text''> <p> Text <%= text_field_tag :Title, nil, :size => ''50'' %> Importance <%= select_tag ''t1'', options_for_select(options)%> <remove><%= link_to_function ''Remove text field'', "this.up(''.text'').remove()" %></remove> </p> </div> This is (or I try it to be) a complex forms whose text fields are in groups, and you can add and remove both text fields and groups. The only thing that is not working is the "Add group" link_to_function. -- Posted via http://www.ruby-forum.com/.
Jeffrey L. Taylor
2009-Jul-28 17:48 UTC
Re: page.insert_html does not insert html with link_to_function
Quoting Victor Martin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Jeffrey L. Taylor wrote: > > Quoting Victor Martin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: > >> end%> > >> This way, it does not insert the partial. But, if I remove the > >> "link_to_function", it does insert it! > > > > I am confused. Is the ''group'' partial the first bit of code? And the > > second > > piece of code calls it? And what is the contents of the text partial? > > > > Jeffrey > > _text is like this: > > <% options = {''Normal text'' => ''normal'', ''Highlighted text'' => > ''highlighted'', ''Notes'' => ''notes''} %> > <div class=''text''> > <p> > Text <%= text_field_tag :Title, nil, :size => ''50'' %> Importance <%= > select_tag ''t1'', options_for_select(options)%> > <remove><%= link_to_function ''Remove text field'', > "this.up(''.text'').remove()" %></remove> > </p> > </div> > > > This is (or I try it to be) a complex forms whose text fields are in > groups, and you can add and remove both text fields and groups. The only > thing that is not working is the "Add group" link_to_function. >Interesting. It works for me. If it were my code, I''d double check what is actually there versus what you''ve typed into the e-mails AND look at the code immediately BEFORE the code you''ve typed or pasted into the e-mails. Look for extra or missing quotes and braces (AKA squiggly brackets). If you have an editor that does syntax highlighting/coloring, use it and be sure it agrees with you on the syntax of your code. HTH, Jeffrey
Victor Martin
2009-Jul-28 20:16 UTC
Re: page.insert_html does not insert html with link_to_function
Jeffrey L. Taylor wrote:> Quoting Victor Martin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> > >> <remove><%= link_to_function ''Remove text field'', >> "this.up(''.text'').remove()" %></remove> >> </p> >> </div> >> >> >> This is (or I try it to be) a complex forms whose text fields are in >> groups, and you can add and remove both text fields and groups. The only >> thing that is not working is the "Add group" link_to_function. >> > > Interesting. It works for me. If it were my code, I''d double check > what is > actually there versus what you''ve typed into the e-mails AND look at the > code > immediately BEFORE the code you''ve typed or pasted into the e-mails. > Look for > extra or missing quotes and braces (AKA squiggly brackets). If you have > an > editor that does syntax highlighting/coloring, use it and be sure it > agrees > with you on the syntax of your code. > > HTH, > JeffreyHi Jeffrey, thanks for posting! Does it work for you? omfg, this is driving me crazy. I just copy/pasted my code to the forum :( I checked this a hundred times, it may be something I am unable to notice (since I''m quite a newbie, it''s highly possible). I uploaded the code here ( http://www.megaupload.com/?d=I0ZAJZOO ), just in case anyone has the time to check it. This is the address for the page where the problem is: http://yourlocalserver/collect/text I don''t know what else to do :( -- Posted via http://www.ruby-forum.com/.
suchi gupta
2013-Jan-25 07:47 UTC
[Rails] I am trying to add a block dynamically. I is giving an error saying “wrong no. of arguments”(1 for 2
<div id="new_campaign" <%render :partial =>''new_campaign_partial''%> </div> <%= link_to_function "Add a campaign" do |page| inser_html :bottom, :new_campaign, :partial=>''new_campaign_partial'' end%> the partial is named new_campaign_partial.rhtml. It has just the html code for creating certain text fiels and calendar -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Jim Ruther Nill
2013-Jan-25 07:55 UTC
Re: [Rails] I am trying to add a block dynamically. I is giving an error saying “wrong no. of arguments”(1 for 2
On Fri, Jan 25, 2013 at 3:47 PM, suchi gupta <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> <div id="new_campaign" > <%render :partial =>''new_campaign_partial''%> > </div> > > <%= link_to_function "Add a campaign" do |page| > inser_html :bottom, :new_campaign, :partial=>''new_campaign_partial'' > end%> >If I remember correctly, link_to_function does not accept a block> > > > the partial is named new_campaign_partial.rhtml. It has just the html > code for creating certain text fiels and calendar > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.