Forums

Populating JEditor using drop down

rahulngupta 28 Jul, 2009
Hello,

I would request some help on the following issue:
Users can post articles on my site, but there are a few default templates they can choose from.

So I have inserted the tinyMCEditor in my form. I want data to be filled in this based on what the user chooses as a template from a drop down menu.

The code for the editor looks like this: (got this from this forum itself🙂
<?php
$editor =& JFactory::getEditor();
echo $editor->display( 'fulltext', '' , '25%', '350', '20', '15', false ) ;
?>

The syntax for display says that the second parameter can be some form of pre-defined text.

I assume that this will use some form of Java Script. I have tried but have not been able to achieve the result.

Another problem is that when I try and take the onchange javascript codes from elsewhere on the net and try putting it in chronoforms for filling in simple text fields, it doesn't seem to work. Do I have to make some changes in the settings for it to work. An example of such a code which doesn't work on my form is as follows:

<head>
<script language=Javascript>
function Choice()
{
test.Populate.value = test.blah.value;
}
</script>
</head>

<form name=test>
<select name=blah onChange='Choice();'>
<option value=1>1</option>
<option value=1>1</option>
<option value=1>1</option>
</select>
<input type=text name=Populate>
</form>



I will be very thankful for any help on the issue.

Regards
Rahul
GreyHead 29 Jul, 2009
Hi rahulngupta,

I think the second paramter is just plain text e.g. 'write something here'

I'd be most surprised if either php or JavaScript did anything except break your code.

I also doubt if you can change the editor default text using JavaScript - that would have to be don on te4h servers ide before the editor is created.

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