質問

また、レールプロジェクト.タグを用いobserve_fieldいてテキスト入力テキスト領域で処理制御、表示し、結果を本部長と類似のプレビュースタックオーバーフロー).全ての色がでていただいたものとさせていた一部の特殊文字数.

  1. ?=>原因の変数は、paramsオブジェクト
  2. (ポンド)=>の原因となる無効の真正性エラ
  3. %=>停止する部から更新
  4. &=>も後にはない渡された変数のサーバーです。

があるので、解決す。

---コードサンプル---

する方は受付にお申し出ください('postbody'テキストエリア)

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

このコントローラーと呼ばれる

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 

これは、javascriptで作成される:

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')})})
役に立ちましたか?

解決

これは逃避行示します。

してください変更observe_field:述のようなもの:

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

その後コントローラ:

def textile_to_html
  text = URI.unescape(params['postbody'])
  ...

他のヒント

できるからご提供いただいたサンプルコード?

よきする必要があり逃げごHTMLエンティティのトラブルを使用 encodeuri があります。

ものは何か、生成されたJavascriptの音も聞こえてきます。

音(一見のようになって自動的にエスケープされます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top