[英]Multiple form with TinyMCE on one page
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. 我在一页中有多种形式(循环加载),每种形式都有TinyMCE输入,但实际上只有第一种是用TinyMCE格式化的,其他则是普通输入。
I use this helper (cakephp 2.5 project) : http://bakery.cakephp.org/articles/galitul/2012/04/11/helper_tinymce_for_cakephp_2 我使用了此帮助程序(cakephp 2.5项目): 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. 感谢您的帮助和时间。
I think this is a well-known "bug." 我认为这是一个众所周知的“错误”。 Try dynamically changing the id
s for each textarea
. 尝试动态更改每个textarea
的id
。 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 textarea
s have the same id
. 尽管TinyMCE声称它将使用textarea
选择器将所有textareas渲染为TinyMCE小部件,但是,如果所有textarea
具有相同的id
,TinyMCE不会这样做。 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. 它将渲染第一个,遇到第二个,并认为它已经为其渲染了一个小部件,因为它具有与最后一个相同的id
。 That's why only the first textarea
is rendering as a TinyMCE widget. 这就是为什么只有第一个textarea
呈现为TinyMCE小部件的原因。
This is fair, I suppose, since id
s are supposed to be unique identifiers in HTML: http://www.sitepoint.com/web-foundations/id-html-attribute/ . 我想这很公平,因为id
应当是HTML中的唯一标识符: http : //www.sitepoint.com/web-foundations/id-html-attribute/ 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.