Adding text to textarea editor dynamically

emmexx 11 Dec, 2013
I need to be able to select a value from a dropdown, get some data (based on the previous selected value) from a table using ajax, populate some field on the form.

E.g. I select an "email template" and the subject and body fields are populated by the text predefined in a table.

I have no problem doing all that, apart from entering the text in a textarea with the (TinyMCE) editor active.

I suppose that the text should be entered using a TinyMCE method.

Any hint on how to accomplish that? The best solution would be something editor independent, but I can go with a TinyMCE-only too.

Thank you
maxx
Max_admin 13 Dec, 2013
Hi maxx,

If the editor is active then you will have to use a tinyMCE function, it depends on the editor's version, if you have J3.2 then it may be V4, otherwise it should be V3, the function itself can be found on Google or on the tinyMCE site!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
emmexx 15 Dec, 2013
Thank you, I used:
tinyMCE.get('textarea name').setContent(myhtmltext, {format : 'raw'});

Note that in the command you should refer to the name of the element, not the id.
That is for J2.5, tinyMCE 3.

bye
maxx
This topic is locked and no more replies can be posted.