How to configure TinyMCE in Nette

Usefull links

Attach TinyMCE to textarea

$form->addTextArea('text', 'Text')
    ->setAttribute('class', 'mceEditor');
    mode: "specific_textareas",
    editor_selector: "mceEditor",


$form->addTextArea('text', 'Text')
    mode: "exact",
    elements: "mceEditor",

Configuring validation

To enable validation in textarea with TinyMCe it is important to save written text to textarea before Nette validation.

If a form contains only one button (or if all buttons runs validation) you can attach text saving on onSubmit of the form.


If one of the buttons doesn't run validation (i.e., “Back”, set up by setValidationScope), validation is attached to onClick of those buttons, which run the validation.

foreach ($form->getComponents(TRUE, 'SubmitButton') as $button) {
    if (!$button->getValidationScope()) continue;