Hello,
is there any possibility to insert text into an fckeditor-field with an external javascript?
Users can write messages and have several text modules. These modules should be added to the textarea of fckeditor by clicking on some links.
is there any possibility to insert text into an fckeditor-field with an external javascript?
Users can write messages and have several text modules. These modules should be added to the textarea of fckeditor by clicking on some links.

Re: Inserting Text with Javascript
Larry
Re: Inserting Text with Javascript
can you post your workaround? i think there are ore users (i'm too) who are interested.
Greetz
Viitti76
Re: Inserting Text with Javascript
var FCKMyCombo_command = function(name) { /* The 'name' parameter doesn't do anything. You could define above using: a) var FCKMyCombo_command = function() { or b) var FCKMyCombo_command = function(name, var1, var2, var3) { or c) what ever you like Just remember to reflect this at the 'FCKCommands.RegisterCommand( 'mycombocommand' , new FCKMyCombo_command('any_name') ) ;' line below. EG: a) FCKCommands.RegisterCommand( 'mycombocommand' , new FCKMyCombo_command() ) ; b) FCKCommands.RegisterCommand( 'mycombocommand' , new FCKMyCombo_command('any_name', 'var1', 'var2', 'var3') ) ; c) what ever you like */ this.Name = name ; } //This get's executed when an item from the combo list gets selected FCKMyCombo_command.prototype.Execute = function(itemText) { if (itemText != "") //The itemText part is the Dropdown Text //The itemTempText part is the text placed in the editor if(itemText =="First Entry"){itemTempText="FirstEntry"}; if(itemText =="Second Entry"){itemTempText="SecondEntry"}; if(itemText =="Third Entry"){itemTempText="ThirdEntry"}; if(itemText =="Fourth Entry"){itemTempText="FourthEntry"}; //This is the text insertion piece that place the text in the editor FCK.InsertHtml(itemTempText); } //was getting GetState is not a function (or similar) errors, so added this. FCKMyCombo_command.prototype.GetState = function() { return; } FCKCommands.RegisterCommand( 'mycombocommand' , new FCKMyCombo_command('any_name') ) ; /* 2nd, create the Combo object */ var FCKToolbarMyCombo=function(tooltip,style){ this.Command=FCKCommands.GetCommand('mycombocommand');//the command to execute when an item is selected this.FieldWidth=130; this.PanelWidth=200; this.CommandName = 'mycombocommand'; this.Label=this.GetLabel(); this.Tooltip=tooltip?tooltip:this.Label; //Doesn't seem to work this.Style=style; //FCK_TOOLBARITEM_ICONTEXT OR FCK_TOOLBARITEM_ONLYTEXT }; FCKToolbarMyCombo.prototype=new FCKToolbarSpecialCombo; //Label to appear in the FCK toolbar FCKToolbarMyCombo.prototype.GetLabel=function(){ //The following is the First Entry you want in the Dropdown return "Select Text to Insert"; }; //Add the items to the combo list FCKToolbarMyCombo.prototype.CreateItems=function(A){ //this._Combo.AddItem(itemText, itemLabel); //see FCKMyCombo_command.prototype.Execute = function(itemText, itemLabel) above this._Combo.AddItem("First Entry","First Entry"); this._Combo.AddItem("Second Entry","Second Entry"); this._Combo.AddItem("Third Entry","Third Entry"); this._Combo.AddItem("Fourth Entry","Fourth Entry"); } //Register the combo with the FCKEditor FCKToolbarItems.RegisterItem( 'mycombo' , new FCKToolbarMyCombo( 'My Combo', FCK_TOOLBARITEM_ICONTEXT ) ) ; //or FCK_TOOLBARITEM_ONLYTEXTThen what you need to do is put ['mycombo'] that in the FCKConfig.ToolbarSets of the toolbar you are displaying. That should be all you need to display the dropdown in the toolbar. Once you pick something from the dropdown it should place the text into the fckeditor window. I have commented in the code to show what you need to do and what it does. Let me know if you need more information.
Hope that helps you,
Larry
Re: Inserting Text with Javascript
Thank you.
But it will be a part of the editor? That is not what I searching for. I need a dynamical solution via a mysql-query.
Can you show on thread viewtopic.php?f=5&t=16446 ? Have you a hint for me?
Viiti