# Populate fckeditor using form\_for and fields\_for with 2 models and namespace

**URL:** <https://www.ruby-forum.com/t/populate-fckeditor-using-form-for-and-fields-for-with-2-models-and-namespace/145961>\
**Category:** Rails\
**Created:** [August 15, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/populate-fckeditor-using-form-for-and-fields-for-with-2-models-and-namespace/145961 "2008-08-15T15:47:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9a28c/32.png) [@mikej](https://www.ruby-forum.com/u/mikej)\
**Post date:** [August 15, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/populate-fckeditor-using-form-for-and-fields-for-with-2-models-and-namespace/145961/1 "2008-08-15T15:47:28Z")

</div>

I am using the form below. text\_html in the form defaults to the  
value of @text\_html.text.html defined in the action. The textarea  
does not. How do I populate the text area with @text\_html.text.html?  
Note I am using a namespace in form\_for.

When I submit the form the it submits:

“admin”=\>{“text\_html”=\>“

asdfasdfasd sadf asdf asdf asdf asdf

”}

My form:

\<%= javascript\_include\_tag :fckeditor %\>

\<% form\_for([:namespace,:admin], :url =\> { :action =\> :update ,:id =\>  
@client.permalink}) do |form| %\>

```
  <% fields_for :title do |t| %>
   <%= t.text_field :title %><br/>
   <% end %>

  <% fields_for :text_html do |th| %>
   <%= th.text_field :text_html %><br/>
   <%= fckeditor_textarea("admin", "text_html", :toolbarSet =>
       "Basic", :width => "600", :height => "600px") %>
   <% end %>

  <%= submit_tag 'Save',:class => "submit" %>

```

\<% end %\>

Many thanks,

Mike

---

<div class="post-metadata">

**Author:** ![mikej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9a28c/32.png) [@mikej](https://www.ruby-forum.com/u/mikej)\
**Post date:** [August 15, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/populate-fckeditor-using-form-for-and-fields-for-with-2-models-and-namespace/145961/2 "2008-08-15T17:42:27Z")

</div>

Well

```
   <%= fckeditor_textarea(:text_html, :text_html, :toolbarSet =>
       "Basic", :width => "600", :height => "600px") %>

```

works. I tried this first. Not sure why it works now. Grr.

Mike
