How one can use a JS variable in the ruby code? --~--~---------~--~----~------------~-------~--~----~ 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 Jun 4, 2:37 pm, Sachin <sachin.srivastava1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How one can use a JS variable in the ruby code?Depends what you mean. if you want a link or similar to submit a javascript variable then have a look at http://www.spacevatican.org/2008/5/17/with-or-without-you-link_to_remote-s-mysterious-parameter 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Have you figured this out yet? I am looking for the same thing. How would you set a ruby variable inside a javascript method? Say something like this... <SCRIPT language="JavaScript"> function submitform(nextQuestion) { <% @nextQuestion = nextQuestion %> document.form1.submit(); } </SCRIPT> Thanks -- 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 Jun 4, 11:18 pm, Chris Hickman <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Have you figured this out yet? I am looking for the same thing. How > would you set a ruby variable inside a javascript method? Say something > like this... > > <SCRIPT language="JavaScript"> > > function submitform(nextQuestion) > { > <% @nextQuestion = nextQuestion %> > document.form1.submit(); >That''s completely impossible - client side code cannot have server side effects (except of course via a request of some sort). If you are trying to change what the form submits, then a classic technique is to have a hidden field on the form that the javascript manipulates. Fred> } > > </SCRIPT> > > Thanks > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---