Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 83191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:44:05+00:00 2026-05-10T21:44:05+00:00

I am working on a rails project. Using the tag observe_field, I am taking

  • 0

I am working on a rails project. Using the tag observe_field, I am taking text typed into a text area, processing it in a control, and displaying the result in a div (very similar to the preview in stack overflow). Everything works fine until I type certain special chars.

  1. ? => causes the variable not to be found in the params object
  2. (pound) => causes an invalid authenticity error
  3. % => stops the div from being updated
  4. & => every thing after the & is no longer passed into the variable on the server.

Is there a way to solve this?

— code sample —

this is the view. ( ‘postbody’ is a text area)

<%= observe_field 'postbody',                      :update => 'preview',                      :url => {:controller => 'blog', :action => 'textile_to_html'},                     :frequency => 0.5,                     :with => 'postbody' -%> 

this is the controller that is called

def textile_to_html     text = params['postbody']     if text == nil then          @textile_to_html = '<br/>never set'     else          r = RedCloth.new text         @textile_to_html = r.to_html     end      render :layout => false  end  

and this is the javascript that is created:

new Form.Element.Observer('postbody', 0.5, function(element, value) {new Ajax.Updater('preview', '/blog/textile_to_html', {asynchronous:true, evalScripts:true, parameters:'postbody=' + value + '&authenticity_token=' + encodeURIComponent('22f7ee12eac9efd418caa0fe76ae9e862025ef97')})}) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:44:06+00:00Added an answer on May 10, 2026 at 9:44 pm

    This is an escaping issue (as stated by others).

    You’ll want to change your observe_field :with statement to something like:

      :with => ''postbody=' + encodeURIComponent(value)' 

    Then in your controller:

    def textile_to_html   text = URI.unescape(params['postbody'])   ... 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the will_paginate gem for my Rails project and it's working beautifully. Unfortunately,
im working in a project writen in ruby on rails and im currently using
Hi I am working on a Rails 3 project and I am using acts-as-taggable-on
I am working on a rails project using svn. I generated a migration file
I am working on ruby rails project. I am using Rails 2.3.4 and ruby
This is my first project using Ruby on Rails and I'm working on the
I'm working on a Rails project OldApp that's using STI for some class Foo.
I was working on some project using webrat and cucumber (rails 3), so I
I'm working on a rails project using, cucumber, capybara and factory girl, and recently
I've installed foundation into my Rails project using their gem and running the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.