[CKEditor.Reactive] cannot read property 'setData' of undefined

Forge Component
(1)
Published on 31 Mar (4 days ago) by David Farinha
1 vote
Published on 31 Mar (4 days ago) by David Farinha

Hi hi,

I am getting the error "cannot read property 'setData' of undefined" whenever i call SetEditorData in my GetDataOnAfterFetch, like this:

Suggestion on how to resolve are welcome.

Saludos,

Wilko

This is where the java script goes wrong:

Do i need to include something somewhere so it finds the setData function?

Saludos,

Wilko

Why did you have to call the "SetEditorData" action?

CKEditor.Reactive is providing the "InputId" property for connecting to your input (text area).

It gets data(HTML text) from your input and adds it to the Editor automatically.

No need calling "SetEditorData" action


wilko odijk wrote:

This is where the java script goes wrong:

Do i need to include something somewhere so it finds the setData function?

Saludos,

Wilko


Please find the demo for reference.

I hope this will help you.

Happy Coding

Amreen


Solution

wilko odijk wrote:

This is where the java script goes wrong:

Do i need to include something somewhere so it finds the setData function?

Saludos,

Wilko

Look likes you don't have CKEditor object instance in your screen.
Could you please check the CKEditor Jquery/Java Script file are added/loaded in your screen.(see using page source of your screen)


Solution

Salman hi,

Somehow that javascript didn't get loaded on the page, resulting in the error. I removed all ckeditor references, removed unused dependencies, published couple of times, and added the ckeditor again to the page, and now it is ok. Thanks for the help.

Saludos,

Wilko

wilko odijk wrote:

Salman hi,

Somehow that javascript didn't get loaded on the page, resulting in the error. I removed all ckeditor references, removed unused dependencies, published couple of times, and added the ckeditor again to the page, and now it is ok. Thanks for the help.

Saludos,

Wilko


Hi,

Good to hear that your problem has been resolved.
Happy coding :)

Thanks,

Salman

Salman hi,

I remember why i did the SetEditorData call in the first place. If i do just the thing that Duc told me, it works, but only the first time. So if have a popup that i open in which the ckeditor is linked to the text input:


the first time i open the popup this happens (all good):

the second time and from there on:

If i close the page and open the popup the first time, there is data again. the second time not.

this is not handy, so i'll revert for now to just the textarea input.

Saludos,

Wilko

You need to re initiate the jquery/java script code when you open second time.So that all the needed JS will be initialized again.


Salman hi,

The textarea and the ckeditor are in a webblock in a popup, which is on a page.

I have two scenarios, one is where the user opens the popup first time (goes well), closes the popup and opens the popup again, and the text does not appear. second is where in the popup the data gets refreshed, after the refresh the text does not appear.

On the main page:

In the webblock:

Do i need to check the ContentChanged event to refresh the java script, and how would i do that? if not on the event, then where could i refresh the js?

in the first scenario, the webblock gets opened again so i could do something on the initialize or on the parameter changed event, in the second scenario there is a client action that creates new content from a refresh of the data fetched for the screen that is linked to the textarea widget, so the reactive should refresh the textarea. I am not sure where and how i can refresh the ckeditor js myself.

Saludos,

Wilko