I have a PHP application with the following in one of the "views": <input type="button" onClick="newAlt()" value=" + "></nobr> The JavaScript for "newAlt()" is: // using DOM create new input box for alternate part function newAlt() { var html = "<input style=''background-color:#FFFFCC'' "; html += "type=''text'' id=''rowcol'' name=''partalternate.0.altpartnumber'' "; html += "joinkey=''partid=<?=$partid?>'' "; html += "attrib=''unique'' size=''20'' "; html += "onChange=''cellTripolar(this)''>\n"; document.getElementById("partnumber").innerHTML += html; html = "<input style=''background-color:#FFFFCC'' "; html += "type=''text'' id=''rowcol'' name=''partalternate.0.altmanufacturer'' "; html += "joinkey=''partid=<?=$partid?>'' "; html += "attrib=''unique'' size=''20''> "; document.getElementById("manufacturer").innerHTML += html; } What is the Rails way to render the HTML that get''s dynamically added to the page when the user presses the "+" button? --wpd --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 13 Dec 2008, at 15:49, Patrick Doyle wrote:> I have a PHP application with the following in one of the "views": > > <input type="button" onClick="newAlt()" value=" + "></nobr> > > The JavaScript for "newAlt()" is: > > // using DOM create new input box for alternate part > function newAlt() { > var html = "<input style=''background-color:#FFFFCC'' "; > html += "type=''text'' id=''rowcol'' name=''partalternate. > 0.altpartnumber'' "; > html += "joinkey=''partid=<?=$partid?>'' "; > html += "attrib=''unique'' size=''20'' "; > html += "onChange=''cellTripolar(this)''>\n"; > document.getElementById("partnumber").innerHTML += html; > html = "<input style=''background-color:#FFFFCC'' "; > html += "type=''text'' id=''rowcol'' name=''partalternate. > 0.altmanufacturer'' "; > html += "joinkey=''partid=<?=$partid?>'' "; > html += "attrib=''unique'' size=''20''> "; > document.getElementById("manufacturer").innerHTML += html; > } > > What is the Rails way to render the HTML that get''s dynamically > added to the page when the user presses the "+" button?update_page do |page| page.insert_html :bottom, ''partnumber'', :partial => ''some_partial'' page.insert_html :bottom, ''manufacturer'', :partial => ''some_other_partial'' end would generate javascript similar to the body of that method Fred --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sat, Dec 13, 2008 at 11:34 AM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 13 Dec 2008, at 15:49, Patrick Doyle wrote: > > > I have a PHP application with the following in one of the "views": > > > > <input type="button" onClick="newAlt()" value=" + "></nobr> > > > > The JavaScript for "newAlt()" is: > > > > // using DOM create new input box for alternate part > > function newAlt() { > > var html = "<input style=''background-color:#FFFFCC'' "; > > html += "type=''text'' id=''rowcol'' name=''partalternate. > > 0.altpartnumber'' "; > > html += "joinkey=''partid=<?=$partid?>'' "; > > html += "attrib=''unique'' size=''20'' "; > > html += "onChange=''cellTripolar(this)''>\n"; > > document.getElementById("partnumber").innerHTML += html; > > html = "<input style=''background-color:#FFFFCC'' "; > > html += "type=''text'' id=''rowcol'' name=''partalternate. > > 0.altmanufacturer'' "; > > html += "joinkey=''partid=<?=$partid?>'' "; > > html += "attrib=''unique'' size=''20''> "; > > document.getElementById("manufacturer").innerHTML += html; > > } > > > > What is the Rails way to render the HTML that get''s dynamically > > added to the page when the user presses the "+" button? > > > update_page do |page| > page.insert_html :bottom, ''partnumber'', :partial => ''some_partial'' > page.insert_html :bottom, ''manufacturer'', :partial => > ''some_other_partial'' > end > > would generate javascript similar to the body of that method > > > Fred >Thanks... that gives me the direction to go looking. I''ll still need to figure out whether that code coes in the view or in the controller, and how one hooks up that code to the onClick property of the button, but I''m sure there are 100''s of tutorials out there that describe that. Thanks again. --wpd --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---