Not able to call JS fuction from rich text component | Community
Skip to main content
GK-007
Level 9
October 16, 2015
Solved

Not able to call JS fuction from rich text component

  • October 16, 2015
  • 4 replies
  • 1571 views

Hi All,

I have configured two links using anchor tags using Rich text component.

I could see the source code of added links using source button available on Rich Text dialog.

Now i want to call JS function on clicking of this links,i have added js function to this source code.When i am clicking on the links it's giving below error.

"Uncaught TypeError: Cannot read property 'dom' of null "

How to call JS function?

Please help me in this regard.

Thanks,

Kishore

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by edubey

[img]Capture_1.JPG[/img]

I have tried to implement same, it seems to be working. Let me if this is not what you are expecting.

4 replies

edubey
edubeyAccepted solution
Level 10
October 16, 2015

[img]Capture_1.JPG[/img]

I have tried to implement same, it seems to be working. Let me if this is not what you are expecting.

smacdonald2008
Level 10
October 16, 2015

When you want to use JS code in AEM components (including calling JS methods)- write a custom xtype. In your use case - writing a custom xtype would involve using this data type:

http://docs.adobe.com/docs/en/cq/5-6-1/widgets-api/index.html?class=CQ.form.RichText

Then you have access to all event handlers, properties, and methods that belong to this data type. 

TO learn how to create a simple custom xtype in AEM - see: 

https://helpx.adobe.com/experience-manager/using/creating-custom-xtype.html 

GK-007
GK-007Author
Level 9
October 16, 2015

edubey wrote...

I have tried to implement same, it seems to be working. Let me if this is not what you are expecting.

 

i am also trying the same.Are you seeing any kind of errors on you browser related to widget.js?

edubey
Level 10
October 16, 2015
Nopes...my function seems to be working fine. Please share couple of more screenshot s