Mike,
In addition to Chris' very detailed response, I did a bit of searching and
this is what you need to be able to access the cftextarea...
var editorinstance = ColdFusion.objectCache['MyEditorTextAreaName'];
var oEditor = FCKeditorAPI.GetInstance(editorinstance.richtextid);
oEditor.InsertHtml('abc');
Where "MyEditorTextAreaName" is the name of your CFTEXTAREA.
I tested with CF8, and this works great.
Hope this helps!
--
Ken Auenson, II
On 10/18/07, Chris Champion <[EMAIL PROTECTED]> wrote:
>
> OK, I'm running without a net here since I'm still running CF7, but I've
> done a bunch of work with the core editor (fckeditor) you're interacting
> with so here's a roadmap.
> (1) If you haven't already, install Firefox and the Firebug plugin, it
> makes debugging the JavaScript much much easier. Remember that JS is
> case-sensitive!
>
> (2) initialize the API in javascript: var oEditor =
> FCKeditorAPI.GetInstance('InstanceName')
> (You may have to do some fancy walking of the DOM to initialize the API,
> use the DOM inspector in Firefox to figure out the appropriate iframe name.
> I would try just putting the script in the page after the cfform is done.)
> InstanceName is probably going to be the same name you assigned to the
> editor in the CF tag.
>
> (3) Call oEditor.InsertHtml( ###your desired text here### )
>
> So try this first, maybe you'll be amazingly lucky but I bet there's an
> error message on the way. :)
> <select name="foo" multiple="multiple" size="4"
> onDblClick="insertField(this)">
> <option value="##name##">[name]</option>
> <option value="##phone##">[phone]</option>
> </select>
> <script>
> oEd = FCKeditorAPI.GetInstance('letterBody'); //or whatever right name is
> for your instance
> function insertField(oSelector) {
> oEd.InsertHtml(oSelector.options[oSelector.selectedIndex].value);
> }
> </script>
>
> Good luck!
> -CPC
> --
> ------------------------
> Houston ColdFusion Users Group
> www.houcfug.org
> [EMAIL PROTECTED]
>
>
> On 10/18/07, Mike <[EMAIL PROTECTED]> wrote:
> >
> >
> > I want to Thank Ken and Christopher for their input on this topic at
> > last nights meeting.
> >
> > I have begun implementing Ken's suggestion of Clicking on a select box
> > and having the field input into the text area.
> >
> > The Javascript works for a regular <textarea> tag however the same
> > code will not work with the <cftextarea>. Is there any special syntax
> > that I need to do to get the javascript to work with the <cftextarea>
> > tag
> >
> > below is the code i am using to update the textarea
> >
> > var k =
> > document.forms(0).fields.options[document.forms
> > (0).fields.selectedIndex].value;
> > document.forms(0).textbody.value = k;
> >
> > This exact javascript works when I change the <cftextarea> tag to a
> > <textarea> tag, but does nothing for a <cftextarea>.
> >
> > Thanks,
> >
> > Mike
> >
> > On Oct 4, 12:57 pm, "Mike Demahy" <[EMAIL PROTECTED]> wrote:
> > > Mike,
> > >
> > > Thanks for the Drag and Drop help. I have just had the time to look
> > at it
> > > since returning from the conference. I think this will help.
> > >
> > > Mike Demahy
> > > 713-418-6707
> > > [EMAIL PROTECTED]
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: [email protected] [mailto: [EMAIL PROTECTED] On
> > Behalf
> > >
> > > Of Mike Gillespie
> > > Sent: Thursday, September 27, 2007 1:37 PM
> > > To: Houston ColdFusion Users' Group
> > > Subject: [houcfug] Re: Drag and Drop
> > >
> > > Mike,
> > >
> > > Take a look at this page. I think this may do what you are looking
> > > for at the cost of a few brain cells...
> > >
> > > http://www.openrico.org/demos?demo=drag_and_drop_simple
> > >
> > > On Sep 26, 4:23 pm, "Mike Demahy" <[EMAIL PROTECTED]> wrote:
> > > > Hello everyone,
> > >
> > > > I am writing a mail merge program for my users. I am using the new
> > Rich
> > > > Text editor in a textarea with CF8. What I want to do is allow the
> > user
> > > to
> > > > create their letter and add code words that represent fields like
> > > > [community], [ClientName], etc in the letter, then when I mail merge
> > the
> > > > document replace the fields with the actual data, then use
> > cfdocument to
> > > > create a PDF. All of this works great.
> > >
> > > > What I want to do now is add a list of fields in a select box next
> > to the
> > > > textarea that the user can drag and drop fields from the select box
> > to
> > > the
> > > > textarea. That will eliminate any miss-spelled code names.
> > >
> > > > Does anyone know of some code that will do this. I have seen it
> > somewhere
> > > > but can't remember where.
> > >
> > > > Thanks,
> > >
> > > > Mike Demahy
> > >
> > > > 713-418-6707
> > >
> > > > [EMAIL PROTECTED]
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Houston ColdFusion
Users' Group" discussion list.
To unsubscribe, send email to [EMAIL PROTECTED]
For more options, visit http://groups.google.com/group/houcfug?hl=en
-~----------~----~----~----~------~----~------~--~---