Hi How I can change this: <%= radio_button("response_item", id, 1) %><%= h(imitem.grpname) %><br/> <a href="#" onclick="showdesc(''<%= h(imitem.id) %>'');">Help</a>to work on radio button selection to call that same showdesc javascript ? ie. I want to embed that javascript inside of radio button so that once it is selected (clicked) it will launch javascript call to showdesc call. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This works ok <%= radio_button("response_item", id, 1, :onchange => "showdesc(''4'')") %> but now how can i replace value=4 with db id ? <% for imitem in @imitems %> <%= radio_button("response_item", id, 1, :onchange => "showdesc(''4'')") %><%= h(imitem.grpname) %><br/> <% end %> I tried this one: <%= radio_button("response_item", id, 1, :onchange => "showdesc(''<%h(imitem.id) %>'')") %> but this throws an error: compile error /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: syntax error, unexpected tCONSTANT, expecting '')'' _erbout.concat(( submit_tag ''Next'' ).to_s); _erbout.concat "\n" ^ /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: unterminated string meets end of file /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: syntax error, unexpected $end, expecting '')'' On Feb 4, 3:57 pm, KTU <ketuo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi > > How I can change this: > > <%= radio_button("response_item", id, 1) %><%= h(imitem.grpname) %><br/ > > > <a href="#" onclick="showdesc(''<%= h(imitem.id) %>'');">Help</a> > > to work on radio button selection to call that same showdesc > javascript ? ie. I want to embed that javascript > inside of radio button so that once it is selected (clicked) it will > launch javascript call to showdesc call.--~--~---------~--~----~------------~-------~--~----~ 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 4 Feb 2008, at 15:23, KTU wrote:> > This works ok > > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''4'')") > %> > > but now how can i replace value=4 with db id ? > > <% for imitem in @imitems %> > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''4'')") > %><%= h(imitem.grpname) %><br/> > <% end %> > > I tried this one: > > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''<%> h(imitem.id) %>'')") %> >At this point it''s just regular ruby (ie not an erb thingy) so> <%= radio_button("response_item", id, 1, :onchange => > "showdesc(''#{h(imitem.id)}'')") %>Should do the trick Fred> but this throws an error: > > compile error > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: syntax > error, unexpected tCONSTANT, expecting '')'' > _erbout.concat(( submit_tag ''Next'' ).to_s); _erbout.concat "\n" > ^ > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: > unterminated string meets end of file > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: syntax > error, unexpected $end, expecting '')'' > > > On Feb 4, 3:57 pm, KTU <ketuo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hi >> >> How I can change this: >> >> <%= radio_button("response_item", id, 1) %><%= h(imitem.grpname) >> %><br/ >> >>> <a href="#" onclick="showdesc(''<%= h(imitem.id) %>'');">Help</a> >> >> to work on radio button selection to call that same showdesc >> javascript ? ie. I want to embed that javascript >> inside of radio button so that once it is selected (clicked) it will >> launch javascript call to showdesc call. > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Thanks for this one. One more thing. <%= radio_button :imitem, :id, imitem.id, :id => "id", onchange => "showdesc()" %> <%= h(imitem.grpname) %><br/> <%= radio_button("id", id, 1, :onchange => "showdesc(''#{h(imitem.id)}'')") %> <%= h(imitem.grpname) %><br/> What about 1st line. It does not like onchange setting in there. Now if I use 2nd line I get strange HTML code like this: <input id="id_-607895668_1" name="id[-607895668]" onchange="showdesc(''4'')" type="radio" value="1" /> demo<br/> I would like this to be just <input id="1" name="id" onchange="showdesc(''4'')" type="radio" value="1" /> demo<br/> On Feb 4, 6:14 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 4 Feb 2008, at 15:23, KTU wrote: > > > > > > > This works ok > > > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''4'')") > > %> > > > but now how can i replace value=4 with db id ? > > > <% for imitem in @imitems %> > > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''4'')") > > %><%= h(imitem.grpname) %><br/> > > <% end %> > > > I tried this one: > > > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''<%> > h(imitem.id) %>'')") %> > > At this point it''s just regular ruby (ie not an erb thingy) so > > > <%= radio_button("response_item", id, 1, :onchange => > > "showdesc(''#{h(imitem.id)}'')") %> > > Should do the trick > > Fred > > > but this throws an error: > > > compile error > > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: syntax > > error, unexpected tCONSTANT, expecting '')'' > > _erbout.concat(( submit_tag ''Next'' ).to_s); _erbout.concat "\n" > > ^ > > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: > > unterminated string meets end of file > > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: syntax > > error, unexpected $end, expecting '')'' > > > On Feb 4, 3:57 pm, KTU <ketuo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Hi > > >> How I can change this: > > >> <%= radio_button("response_item", id, 1) %><%= h(imitem.grpname) > >> %><br/ > > >>> <a href="#" onclick="showdesc(''<%= h(imitem.id) %>'');">Help</a> > > >> to work on radio button selection to call that same showdesc > >> javascript ? ie. I want to embed that javascript > >> inside of radio button so that once it is selected (clicked) it will > >> launch javascript call to showdesc call.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
ok I found the answer. It needs to be like this: <%= radio_button :imitem, :id, imitem.id, :id => "id", :onchange => "showdesc (''#{h(imitem.id)}'')" %> <%= h(imitem.grpname) %><br/> On Feb 4, 7:34 pm, KTU <ketuo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi > > Thanks for this one. One more thing. > > <%= radio_button :imitem, :id, imitem.id, :id => "id", onchange => > "showdesc()" %> <%= h(imitem.grpname) %><br/> > <%= radio_button("id", id, 1, :onchange => > "showdesc(''#{h(imitem.id)}'')") %> <%= h(imitem.grpname) %><br/> > > What about 1st line. It does not like onchange setting in there. Now > if I use 2nd line I get strange HTML code like this: > > <input id="id_-607895668_1" name="id[-607895668]" > onchange="showdesc(''4'')" type="radio" value="1" /> demo<br/> > > I would like this to be just > > <input id="1" name="id" onchange="showdesc(''4'')" type="radio" > value="1" /> demo<br/> > > On Feb 4, 6:14 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > On 4 Feb 2008, at 15:23, KTU wrote: > > > > This works ok > > > > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''4'')") > > > %> > > > > but now how can i replace value=4 with db id ? > > > > <% for imitem in @imitems %> > > > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''4'')") > > > %><%= h(imitem.grpname) %><br/> > > > <% end %> > > > > I tried this one: > > > > <%= radio_button("response_item", id, 1, :onchange => "showdesc(''<%> > > h(imitem.id) %>'')") %> > > > At this point it''s just regular ruby (ie not an erb thingy) so > > > > <%= radio_button("response_item", id, 1, :onchange => > > > "showdesc(''#{h(imitem.id)}'')") %> > > > Should do the trick > > > Fred > > > > but this throws an error: > > > > compile error > > > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: syntax > > > error, unexpected tCONSTANT, expecting '')'' > > > _erbout.concat(( submit_tag ''Next'' ).to_s); _erbout.concat "\n" > > > ^ > > > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: > > > unterminated string meets end of file > > > /usr/local/webhome/mdm/app/views/imitems/showgroup.html.erb:11: syntax > > > error, unexpected $end, expecting '')'' > > > > On Feb 4, 3:57 pm, KTU <ketuo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> Hi > > > >> How I can change this: > > > >> <%= radio_button("response_item", id, 1) %><%= h(imitem.grpname) > > >> %><br/ > > > >>> <a href="#" onclick="showdesc(''<%= h(imitem.id) %>'');">Help</a> > > > >> to work on radio button selection to call that same showdesc > > >> javascript ? ie. I want to embed that javascript > > >> inside of radio button so that once it is selected (clicked) it will > > >> launch javascript call to showdesc call.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---