I have a form with a bunch of drop down options. I want to have these templates setup corresponding with the drop down choice. I have each of the templates stored in a php file. Let me give an example of how I want this to work:
Drop down choices:
The file accociated with BIO includes:
The file accosciated with Front includes:
So what my issues is that I want to add this code to the text area with javascript when they have chosen one. Here is what I tried before:
I dont know what is going on but it never adds text to the ckeditor text area. Even if i replace myVar1 and myVar2 with something like "hello world".
Drop down choices:
- Bio
- Front
The file accociated with BIO includes:
<h1>Title</h1> <p>Description of this page</p> <table align="center"> <tr> <td>Hello Col 1</td> <td>Hello Col 2</td> </tr> </table>
The file accosciated with Front includes:
<h1>Title</h1> <p>Description of this page and general content goes here</p> <img src="image.jpg" /> <p>Closing information</p>
So what my issues is that I want to add this code to the text area with javascript when they have chosen one. Here is what I tried before:
<script type="text/javascript">
var ckeditor = document.getElementById("ckeditor");
var myVar1 = <?php include('front_page.php'); >;
var myVar2 = <?php include('bio_page.php'); ?>;
function changeCont(page) {
if (page.value = "front") {
ckeditor.value = myVar1;
} else {
ckeditor.value = myVar2;
}
</script>
I dont know what is going on but it never adds text to the ckeditor text area. Even if i replace myVar1 and myVar2 with something like "hello world".

Re: Add text to ckeditor textarea via javascript
var oEditor = CKEDITOR.instances.ckfinder; var value = "<?php include('../g/pages/page.php'); ?>"; oEditor.insertHtml( value );BUT, It just appends to the text area. It does not erase current data. I want it to erase the current data and place new ones.
Re: Add text to ckeditor textarea via javascript