I posted this in another section, but this section is more active, so I'll try here.
I use FCKEditor to manage inventory, and for each peice the client creats thier own text and such. When an page loads there is a blnk form at the top, then a list of the inventory the client could choose from to edit.
What I want to do is allow the client to select from the inventory, and populate the fields dynamically, without page reload.
I have done this with all the fields, but when I replace the textarea with FCKEditor I can't populate it.
Anyone know how this can be done?
Thanks in advance.
I use FCKEditor to manage inventory, and for each peice the client creats thier own text and such. When an page loads there is a blnk form at the top, then a list of the inventory the client could choose from to edit.
What I want to do is allow the client to select from the inventory, and populate the fields dynamically, without page reload.
I have done this with all the fields, but when I replace the textarea with FCKEditor I can't populate it.
Anyone know how this can be done?
Thanks in advance.
RE: Populate on the fly
use the editor Api to set its content: SetHTML
http://wiki.fckeditor.net/Developer%27s ... script_API
RE: Populate on the fly
If I caould see an example I'm sure the rest of it will come clear.
Thanks.
RE: Populate on the fly
The answer
In effort to help others with this problem I would direct you to sample08.html of the /_samples/html/ directory. There are lots of examples there, and below is the answer to this question in particular.
function SetContents(id_key)
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
// Set the editor contents (replace the actual one).
oEditor.SetHTML(document.getElementById('showLoc' + id_key).value) ;
}
In this example SetContents is your function that you created. Inside the SetHTML function the value of the hidden field is passed to the editor.
That's all there is to that. Now you can pass anything to an FCKEditor instance.
Enjoy!