Issue
I am using CakePHP
2.4.1 and Tinymce
for CakePHP2
. I have an Edit page and I want to give some default text (extracted from the database) to one of the <textarea>'s
. Using plain Cake code I have this:
echo $this->Form->input('conditii_plata',array(
'value'=>$conditii_plata[0]['Setare']['value'],
'escape'=>false,
'type' => 'textarea',
));
My question: If I convert it to Tinymce
I can't give it a default value. Is this possible to do?
Solution
No, you cannot without setting the text from Javascript upon TinyMCE init.
You could make your textarea hidden and have a second textarea deal with TinyMCE In your document ready javascript function:
tinymce.init({
selector: '<id of your second textarea>',
....
setup : function(editor){
editor.on('init', function(e){
//copy from hidden textarea
editor.setContent($('<1st textarea id').val());
});
});
});
Then your should manually submit your form and before sending copy the tinymce content to your hidden textarea.
Another aproach is to encode your data to json and deal with it from javascript.
Answered By - kcsoft
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.