Peter Tretiakov
Peter Tretiakov

Reputation: 3410

Ckeditor appears only in first field

I have partial with ckeditor field in it.

<%= form_for [point, page], role: 'form' do |f| %>

    ...

    <div class="form-group">
      <%= f.label :article, 'Текст' %>
      <%= f.cktext_area :article, class: 'form-control', rows: 10, ckeditor: {toolbar: 'mini'} %>
    </div>

    ...

<% end %>

I have two such forms on a page, generated with this code:

<div class="row">
  <div class="col-lg-6">
    <%= render partial: 'point_pages/index_page', locals: {point: @point, page: @page_from} %>
  </div>
  <div class="col-lg-6">
    <%= render partial: 'point_pages/index_page', locals: {point: @point, page: @page_to} %>
  </div>
</div>

but ckeditor loads only on first form. On second partial (with @page_to) it loads only text area without ckeditor toolbar.

Thanks for any ideas!

Upvotes: 0

Views: 45

Answers (1)

Peter Tretiakov
Peter Tretiakov

Reputation: 3410

The problem was with duplicating ids of a text field.

Ckeditor attach it's toolbar to field with certain id. And as I have 2 similar ids on one page, because of 2 similar partials, it attach toolbar only to first one.

Hope, this answer will help somebody someday :)

Upvotes: 1

Related Questions