Forums

Another question about WYSIWYG editor fields

jbudd 25 Feb, 2010
I am using a form to populate K2 items.
The record has introtext and "extra fields" which are concatenated:

[{"id":"1","value":"<some text>"},{"id":"2","value":"<some other text>"}]



First version: use a text area to input the extra fields (it works)
<textarea class="cf_inputbox" rows="3" id="text_9" title="" cols="30" name="literacy" onChange="updatethis(this.form);"></textarea>

and javascript to concatenate the fields
function updatethis(form) {
  form.elements['extra_fields'].value = '[' + '{"id":"1","value":"' + form.elements['literacy'].value  + '"},' + '{"id":"2","........


But when I change the input to an editor pane:
    <?php
$editor =& JFactory::getEditor();
echo $editor->display( 'literacy',  '', '80%', '350', '55', '20', true  ) ;
?>

there is nothing to trigger the javascript.

I tried the suggestions from other posts in the forum but cant get it to work.

So how do i get the equivalent of onChange="updatethis(this.form);" with the editor pane?

Note: an editor pane works for introtext because the editor name matches the field name in the record.
Thanks!
GreyHead 28 Feb, 2010
Hi jbudd,

Sorry, I've never tried to do that. You might look at the page source. It looks as though the editor is in an iframe - the body section has an id but I don't knwo if that is accessible to JavaScript.

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