Try our conversational search powered by Generative AI!

Javascript call when a property is changed

Vote:
 

I want to make a specific javascript call when an image property has changed in the on-page-edit.

Is there any way to hook up EPiServer javascript events when a property has changed, a property of specific typ has changed, any property has changed?

Thanks!

#77898
Nov 28, 2013 10:13
Vote:
 

Hi Erik,

No offical way to do this but: yes, you can hook on JsonRest's patch method like this:

 

this.contentDataStore = this.contentDataStore || dependency.resolve("epi.storeregistry").get("epi.cms.contentdata");
            aspect.after(this.contentDataStore, "patch", lang.hitch(this, function (object, options) {
                // TODO: Raise event or do whatever you want
            }), true);

       

Hope that help!

Ha Bui

#77948
Edited, Nov 29, 2013 7:06
Vote:
 

Thanks a this.

Can you also give me an example of where to put this code. I cannot find any info of how to load it, just examples of custom asset components. But this is not that kind of component...

I must get hold of the dependecy object with dojo I think.

#78029
Dec 02, 2013 11:29
Vote:
 

Hi Erik,

You can put it in initialize method of your addons module. (in case you create new module)

You can put it in postCreate method of your custom property editor. (in case you create new property editor)

...

 

/Ha Bui

P.S You can contact with me via email (Ha.Bui@episerver.com) and we can discuss more)

 

#78033
Dec 02, 2013 12:01
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.