0

I have multiple form (loaded in a loop) in one page and each form have a TinyMCE input but actually only the first is formatted with TinyMCE, the others are ordinary input.

I use this helper (cakephp 2.5 project) : http://bakery.cakephp.org/articles/galitul/2012/04/11/helper_tinymce_for_cakephp_2

I try with :

<?=
$this->Tinymce->input('description', array(
    'name' => 'description',
    'id' => $value[$class]['id'],
    'value' => $value[$class]['description'],
    'class' => 'form-control',
    'type' => 'textarea',
    'label' => false,
    'placeholder' => __('Description')
),
array(),
'exact'); ?>

Thank you for your help and time.

ndm
  • 59,784
  • 9
  • 71
  • 110
hidewak
  • 299
  • 1
  • 4
  • 16
  • What exactly do the `$this->Form->create()` calls look like? Are they all using the same model name? – ndm Aug 14 '14 at 10:09

1 Answers1

0

I think this is a well-known "bug." Try dynamically changing the ids for each textarea. Despite TinyMCE's claims that it'll render all textareas as TinyMCE widgets with the textarea selector, TinyMCE doesn't do so if all the textareas have the same id. It'll render the first one, encounter the second and think it has already render a widget for it since it has the same id as the last one. That's why only the first textarea is rendering as a TinyMCE widget.

This is fair, I suppose, since ids are supposed to be unique identifiers in HTML: http://www.sitepoint.com/web-foundations/id-html-attribute/.

Nagra
  • 466
  • 3
  • 8