Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Dojo, how to make an widget notify EPiServer that another widgets value has been updated?


I have a custom property that's works great except for one thing. It's a basic image editor, first the editor selects an image using a standard episerver image chooser, then the editor pushes a button that opens up a dialog window where it''s possible to crop the image.

The custom property looks like this,

public class ImageEditorBlock : SiteBlockData, IHtmlImage
        Name = "Image Url")]
    public virtual Url ImageUrl { get; set; }

        Name = "",
        Description = "")]
    public virtual string Editor { get; set; }


The editor is simly a button to trigger a dialog window,

    <div data-dojo-type="dijit/form/Button" data-dojo-attach-point="btnImageEdit" data-dojo-props="label:'Crop image'" data-dojo-attach-event='onclick: onClick'></div>


When the the cropping is done the editor selects "Save" that closes the dialog and updates the value in the ImageUrl textbox. My problem is that EPiServer doesn't seem to detect that the value has been changed and therefore the autosave doesn't trigger. If I manually selects the textbox and then deselect it the autosave triggers.

So my question is how can I from a dojo widget (the dialog) trigger the autosave after I've updated the value in another widget (the url textbox)?

Oct 31, 2013 16:37

The editor that has got a changed value need to call the event onChange with the new value. So when the dialog is closed you need to call:


Nov 01, 2013 8:41

Thanks for your answer Linus, unfortunately I'm still struggling with this.  I've tried to call onChange on almost every dojo object I can find. If I look at the source for the EPi url chooser it looks like this,

<div class="epi-formsWidgetWrapper" data-dojo-attach-point="containerNode"><div class="dijitReset dijitInputField dijitInputContainer dijitInline epi-resourceInputContainer dojoDndTarget dojoDndContainer" id="uniqName_108_0" data-dojo-attach-point="dropAreaNode" widgetid="uniqName_108_0">
    <div class="dijit dijitReset dijitInline dijitLeft dijitTextBox" id="widget_dijit_form_TextBox_0" role="presentation" widgetid="dijit_form_TextBox_0"><div class="dijitReset dijitInputField dijitInputContainer"><input class="dijitReset dijitInputInner" data-dojo-attach-point="textbox,focusNode" autocomplete="off" type="text" tabindex="0" id="dijit_form_TextBox_0" value="" aria-disabled="false"></div></div>
    <span class="dijit dijitReset dijitInline dijitButton" role="presentation" widgetid="dijit_form_Button_6"><span class="dijitReset dijitInline dijitButtonNode" data-dojo-attach-event="ondijitclick:_onClick" role="presentation"><span class="dijitReset dijitStretch dijitButtonContents" data-dojo-attach-point="titleNode,focusNode" role="button" aria-labelledby="dijit_form_Button_6_label" tabindex="0" id="dijit_form_Button_6" aria-disabled="false" style="-webkit-user-select: none;"><span class="dijitReset dijitInline dijitIcon dijitNoIcon" data-dojo-attach-point="iconNode"></span><span class="dijitReset dijitToggleButtonIconChar">●</span><span class="dijitReset dijitInline dijitButtonText" id="dijit_form_Button_6_label" data-dojo-attach-point="containerNode">...</span></span></span><input type="button" value="" class="dijitOffScreen" tabindex="-1" role="presentation" data-dojo-attach-point="valueNode"></span>


So on what object should I call onChange?

My code when I close the dialog looks like this,

_onHide: function (evt) {
            this.isShowingChildDialog = false;
            var dojoObject = dijit.byId(;
            //dojoObject.set("value", urlParts.path + cropQueryString);

            var inputField = dijit.byId(dojoObject.domNode.children[0].children[0].id);



Any ideas? Or maybe an example of how to call onChange on another editor / widget?

Nov 01, 2013 10:37

Also try the below options

this._set("value", imageChooser.value);


Nov 01, 2013 10:55

Also, you can make the onBlur call into the Textbox


postCreate: function () {
 var inputField = dijit.byId(dojoObject.domNode.children[0].children[0].id);
this.connect(inputField, "onBlur", this._onChange);


_onChange: function ()
var inputField = dijit.byId(dojoObject.domNode.children[0].children[0].id);
this._set("value", imageChooser.value);



Nov 01, 2013 11:00

Palani, thanks but still no luck. :-/

Nov 01, 2013 11:06

Ok, If the textbox is a readonly property, then the change events are not fired. If thast's your case, please use the below code

var inputField = dijit.byId(dojoObject.domNode.children[0].children[0].id);



Edited, Nov 01, 2013 11:18

Palani, I really appreciate your help. But still no luck.

I've tried all your suggestions now. Nothings seems to make EPiServer understand that's the value's been changed. The only thing is if I manually clicks the textbox and then deselects it again. 


Here is my code if it helps, it's a bit of a mess at the moment though.

Edited, Nov 01, 2013 11:36

If possible can you please share your Html template. In the meantime, please define the event in textbox itself and add the method into your JS file like below


<input type="text" data-dojo-attach-point="inputField" data-dojo-attach-event="onchange:_onChange" /> 

_onChange: function (event) {
    // summary:
    //    Handles the textbox change event and populates this to the onChange method.
    // tags:
    //    private

  this.inputField.set("value", value);




Nov 01, 2013 12:49
    <div data-dojo-type="dijit/form/Button" data-dojo-attach-point="btnImageEdit" data-dojo-props="label:'Crop image'" data-dojo-attach-event='onclick: onClick'></div>


Sure, but as you see my html simply is a single button. The input field I'm using is simply a EPiServer Url chooser as you see in my first post.

Nov 01, 2013 13:28

did anyone get anywhere with this. I've the exact same problem. I can prod a button to cause the episerver form to need a republish.

Have tried manually triggerring the onChange event and setting the value. No luck.

Changing a textbox kworks fine - just like Daniel


Mar 20, 2014 16:31

My collegue Duong an Nguyen has written a blog post that might be of interest for you following this thread:

Mar 27, 2014 14:35

Hi, Daniel and Tim, have you had any luck triggering an event?

I am trying to trigger an onChange event when input type="hidden" changes.

    var pageWidget = getPageWidget(hyperLinkSelector.wrappers);
    if (pageWidget && pageWidget.length > 0) {
        var input = pageWidget[0].inputWidget.input;
        // input is the hidden field
        input.setAttribute("data-dojo-attach-event", "onChange:nodeOnChange");
        input.setAttribute("data-dojo-type", "dijit/form/TextBox");

        on(input, "change", function () {
            var test = xx"; // never gets hit

        // another try with PageChangedEventDijit
        var mydijit = new PageChangedEventDijit({}, input);




function (

) {

    return declare("PageChangedEventDijit",
        [_WidgetBase, _AttachMixin], {
            nodeOnChange: function (e) {
                var test = "test";

 No breakpoints are hit when the hidden field is hit, however, the markup is changed to:

<input type="hidden" data-dojo-attach-point="input" data-dojo-attach-event="onChange:nodeOnChange" data-dojo-type="dijit/form/TextBox" id="PageChangedEventDijit_0" widgetid="PageChangedEventDijit_0" value="15_774">

I've also tried calling parser.parse after adding the attributes to the hidden field.

Apr 02, 2014 12:44


I struggled with this and setting this.isShowingChildDialog = true; when opening the dialog and setting this.isShowingChildDialog = false; when closing the dialog solved it for me.

Oct 27, 2014 11:55


I had the same issue: when you update the value of the widget then publishing event is not triggered and new value is not stored to the server.

And this doesn't work when you use a Dialog or when you close it.

To fix it you should to redirect focus to this:

//take focus to main control
//update a value
this.value = result;
//trigger change event

Feb 02, 2016 17:17
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.