actually, in your case (cf9 + richtext textarea inside jquery dialog)
it is as easy as setting the value of actual textarea element using
jquery before the dialog is opened!

$("textarea[name='socialEventDescription']").val(responseData.socialEventDescription);
$("#dialog").dialog("open");

since cf9 re-draws the richtext textarea, it will show the new value in it.
however, this will NOT work in cf8...

Azadi

On 16/06/2010 02:02, Azadi Saryev wrote:
>  yeah, since cf9 uses newer version of ckeditor, some things have changed...
>
> i have seen some rather weird stuff in my tests now with cf9.
> i guess it has something to do with the textarea being initially hidden,
> and then displayed when the dialog is displayed. this must be causing
> some event chain to fire, which happens to make the ckeditor instance
> associated with the textarea temporarily unavailable. i _think_ that
> maybe the textarea instance is re-drawn (or maybe even drawn for the
> first time) only after the dialog is visible (you may have noticed that
> fckstyles.xml file is requested only after the dialog is shown), and
> that causes the instance to not be defined for a moment.
>
> in any case - if you are still interested - firing the setValue() with a
> delay of 1000 ms after the dialog is opened seems to solve the problem
> in cf9:
>
> var ta = ColdFusion.RichText.getEditorObject('socialEventDescription');
> if (ta) {
>   ColdFusion.RichText.setValue(ta.Name, str);
> } else {
>  
> setTimeout(function(){ColdFusion.RichText.setValue(ColdFusion.RichText.getEditorObject('socialEventDescription').Name,
> responseData.socialEventDescription);}, 1000);
> }
>
> Azadi
>
>
>
> On 16/06/2010 00:59, Scott Brady wrote:
>> Hmmm .... in that case, I may just go with it.  Our dev environments are
>> CF9, but production is CF8.
>>
>> It's on an admin page, so I guess I'll just see what happens and make sure
>> it works.
>>
>> Thanks!
>>
>> Scott
>>
>> On Tue, Jun 15, 2010 at 10:43 AM, Azadi Saryev <[email protected]>wrote:
>>
>>>  it was actually me who was misunderstanding things!
>>> i have misread your question and assumed that you were loading an
>>> external page which contained richtext textarea into a dialog...
>>> not that i see what exactly you are doing, i have run some tests, and,
>>> as you said, in cf9 the textarea does not get the new value...
>>> cf8 does not have this problem and works correctly, though...
>>>
>>> i will play with it some more and post here.
>>>
>>> Azadi
>>>
>>> On 15/06/2010 23:49, Scott Brady wrote:
>>>> Ok, I'm still having issues following this.
>>>>
>>>> Your suggestion is to run the function when the page loads (ajaxonload).
>>>> But, the problem occurs long after the page loads (I can wait 5 minutes
>>>> after the page is done loading to try it, and I still get the issue).
>>>  And,
>>>> putting in an onload handler (either with CF's ajaxonload or using jQuery
>>> to
>>>> append the handler) has it run when the page has loaded -- before I've
>>>> clicked the "edit" button that does the ajax request to get the form's
>>>> values.
>>>>
>>>> Maybe I'm not explaining it well enough.
>>>>
>>>> The dialog that contains the form is part of the initial page load (i.e.,
>>>> it's a hidden div that, upon the document being loaded, is converted into
>>> a
>>>> jquery dialog.  Why would that affect when the ckeditor instance is ready
>>> or
>>>> not?  Even if I wait until the dialog is displayed before populating the
>>>> fields, it throws the error, so it's not just because the dialog is
>>> hidden
>>>> when I try to populate the field.
>>>>
>>>> Alternatively, maybe I don't understand what causes the ckeditor to be
>>>> "ready".
>>>>
>>>> Scott
>>>>
>>>> On Tue, Jun 15, 2010 at 9:05 AM, Azadi Saryev <[email protected]
>>>> wrote:
>>>>
>>>>>  the <textarea> element exists on your page, but its ckeditor (richtext)
>>>>> 'incarnation' does not.
>>>>> thus calling ColdFusion.RichText.setValue() at this stage does not
>>>>> produce any results - because it uses ckeditor-specific javascript
>>>>> functions to populate the ckeditor instance of the textarea (which is
>>>>> actually an ifame, iirc) with content, not the actual <textarea>
>>> element.
>>>>> Azadi
>>>>>
>>>>> On 15/06/2010 22:14, Scott Brady wrote:
>>>>>> But the text area exists on the page already.  The empty cftextarea
>>> would
>>>>> be
>>>>>> available by the time the page loads (and the div isn't made a "dialog"
>>>>>> until after the page loads).  The whole form exists when the page
>>> loads.
>>>>>> The ajax is just to get data for populating the form field values
>>>>>> themselves.
>>>>>>
>>>>>> So, I don't think that's the issue, unless I'm misunderstanding you.
>>>>>>
>>>>>> Scott
>>>>>>
>>>>>> On Mon, Jun 14, 2010 at 10:09 PM, Azadi Saryev <[email protected]
>>>>>> wrote:
>>>>>>
>>>>>>>  On 15/06/2010 10:25, Scott Brady wrote:
>>>>>>>> The success function then populates the form (including the text
>>> area)
>>>>>>> i assume you are talking about $.ajax() [or similar] jquery success
>>>>>>> callback?
>>>>>>> that one will fire before the cf's richtext area is fully ready, thus
>>>>>>> your error.
>>>>>>> what you can do, is move the success callback into a separate named
>>>>>>> function (if you have it defined in-line in success: property of
>>>>>>> $.ajax()), and then call it using ajaxonload() cf function by putting
>>>>>>> <cfset ajaxonload('function-name-here')>
>>>>>>> as the last line before the closing </body> tag in your page that
>>> loads
>>>>>>> inside dialog.
>>>>>>>
>>>>>>> another option is to create a 'listener' that checks if cf richtext
>>> area
>>>>>>> is ready for use, and only then fire your function that populates the
>>>>>>> form. i don;t have code for this as i have never done it this way, but
>>> i
>>>>>>> think it can be done with setInterval() ...
>>>>>>>
>>>>>>> Azadi
>>>>>>>
>>>>>>>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334583
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to