Hi I was trying to call a javascript function.I have text areas like transfer_reason1 transfer_reason2 etc in each divs div number is available as variable div_no in the page..How can I pass the textarea content to the javascript..Below I tried like get_primary_assignees_transfer_reason($(''transfer_reason+eval(#{div_no}))'').value ) How can I evaluate the above to get get_primary_assignees_transfer_reason($(''transfer_reason1'').value ) get_primary_assignees_transfer_reason($(''transfer_reason2'').value ) etc But not working.Please help Sijo -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Sijo Kg wrote:> Hi > I was trying to call a javascript function.I have text areas like > transfer_reason1 > transfer_reason2 etc in each divs > div number is available as variable div_no in the page..How can I pass > the textarea content to the javascript..Below I tried like > get_primary_assignees_transfer_reason($(''transfer_reason+eval(#{div_no}))'').value > ) > > How can I evaluate the above to get > get_primary_assignees_transfer_reason($(''transfer_reason1'').value ) > get_primary_assignees_transfer_reason($(''transfer_reason2'').value ) etc > But not working.Please help > > SijoYou''re mixing javascript with ruby as far as I can see. You can''t ''call'' js functions as long as your code runs on the server (ruby code) The js stuff (vars etc) is only available in the browser. Same goes for dom object methods like value. So div_no won''t be available to ruby. get_primary_assignees_transfer_reason($(''transfer_reason'' + div_no))'').value) should work in the browser. but will never work on the server. -- 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-/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 2 Jun 2008, at 11:29, Sijo Kg wrote:> > Hi > I was trying to call a javascript function.I have text areas like > transfer_reason1 > transfer_reason2 etc in each divs > div number is available as variable div_no in the page..How can I pass > the textarea content to the javascript..Below I tried like > get_primary_assignees_transfer_reason($(''transfer_reason > +eval(#{div_no}))'').value > ) >assuming div_no is a javascript variable, that should be $ (''transfer_reason'' + div_no) Fred> How can I evaluate the above to get > get_primary_assignees_transfer_reason($(''transfer_reason1'').value ) > get_primary_assignees_transfer_reason($(''transfer_reason2'').value ) > etc > But not working.Please help > > Sijo > -- > 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-/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 -~----------~----~----~----~------~----~------~--~---