Filling values in fck editor

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

Filling values in fck editor

Post 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 
 } 
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post 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...
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

Post 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.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

So what exactly do you want to do with the list values?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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?
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

Post 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
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

Post by shivam0101 »

is it possible to send values from

Code: Select all

xmlHttp.responseText

to
fckeditor's

Code: Select all

$oFCKeditor->Value = $newsletter;
?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply