johnhutch
2008-Jan-10 02:22 UTC
Properly parsing carriage returns in Rails so javascript doesn''t freak out
I''ve got some code that "quotes" the contents of a blog post and inserts it into a comment box wrapped in a blockquote. You can view it here: http://pastie.caboo.se/137533 Problem is, every time I try to quote a block of text with more than one line in it, the javascript freaks out. Can anyone tell me how I should be parsing these line breaks properly? thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
chris.mccauley
2008-Jan-10 09:40 UTC
Re: Properly parsing carriage returns in Rails so javascript doesn''t freak out
Hi,
I just call the escape function (js) and it works fine e.g.
<%= link_to_remote "Try it!",:url => { :action
=> :test_rule },
:with =>
"''code=''+escape(rule_rule_body.value)
+''&input_data=''+escape(input_data.value)
+''&business_type=''+escape(rule_business_type.value)"
%>
which passes a block of text for evaluation to the server.
Chris
On Jan 10, 2:22 am, johnhutch
<johnhu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''ve got some code that "quotes" the contents of a blog
post and
> inserts it into a comment box wrapped in a blockquote. You can view it
> here:
>
> http://pastie.caboo.se/137533
>
> Problem is, every time I try to quote a block of text with more than
> one line in it, the javascript freaks out. Can anyone tell me how I
> should be parsing these line breaks properly? thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---