Page 1 of 1

Filling values in fck editor

Posted: Mon Sep 24, 2007 12:27 am
by shivam0101
I have a drop down list from which i will choose an option, the respective values should be filled in fckeditor. I tried to use ajax to retrive the value, but i do not know how to pass it to fckeditor.


This is code to display fckeditor,

Code: Select all

$oFCKeditor = new FCKeditor('newsletter','');
  $oFCKeditor->BasePath = '/admin/fckeditor/';
  $oFCKeditor->Value = $newsletter;
  $newsletter=$oFCKeditor->CreateHTML();

Code: Select all

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
   alert(xmlHttp.responseText);// got struct here.  How to pass this value to $newsletter
  // document.getElementsByName('news').value=xmlHttp.responseText 
 } 

Posted: Mon Sep 24, 2007 3:48 am
by aceconcepts
Do you mean you want the values from the drop-down list to appear in the editor once they are selected "onChange" etc...

Posted: Mon Sep 24, 2007 5:26 am
by shivam0101
No. When i change the values, onChange event, i am sending the value to a javascript function (ajax), i retrive the contents of the text editor from database and send those values to fckeditor.

Posted: Mon Sep 24, 2007 6:08 am
by aceconcepts
So what exactly do you want to do with the list values?

Posted: Mon Sep 24, 2007 6:53 am
by superdezign
shivam0101 wrote:No. When i change the values, onChange event, i am sending the value to a javascript function (ajax), i retrive the contents of the text editor from database and send those values to fckeditor.
Then what seems to be the problem...? Are you not familiar with AJAX?

Posted: Mon Sep 24, 2007 7:21 am
by shivam0101
No. When i change the values, onChange event, i am sending the value to a javascript function (ajax), i retrive the contents of the text editor from database and send those values to fckeditor
.


i should have told,

No. When i change the values, onChange event, i am sending the value to a javascript function (ajax), i retrive the contents of the text editor from database. But, I am not able to assign those values to fckeditor.

Code: Select all

$oFCKeditor = new FCKeditor('newsletter',''); 
  $oFCKeditor->BasePath = '/admin/fckeditor/'; 
  $oFCKeditor->Value = $newsletter; 
  $newsletter=$oFCKeditor->CreateHTML();

Code: Select all

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
 { 
   alert(xmlHttp.responseText);// got struct here.  How to pass this value to $newsletter 
  // document.getElementsByName('news').value=xmlHttp.responseText 
 } 
i want to pass the xmlHttp.responseText to

Code: Select all

$newsletter

Posted: Mon Sep 24, 2007 11:51 pm
by shivam0101
is it possible to send values from

Code: Select all

xmlHttp.responseText

to
fckeditor's

Code: Select all

$oFCKeditor->Value = $newsletter;
?

Posted: Tue Sep 25, 2007 9:57 am
by pickle
FCK does have an API of sorts. I'd be surprised if there wasn't a javascript function you could call that would change the value in the editor.