Skip to main content
replaced http://tridion.stackexchange.com/ with https://tridion.stackexchange.com/
Source Link

The thing is that Field builder has its field, and in this case “load” event means that field builder is loaded, with the fields, but fields are not loaded by itself.

In case of Keyword field, it uses XSLT transformation to render field view.

Unfortunately Keyword select control does not fire any events which might help in this case. Thus I would suggest to extend _onItemDraw method from \WebUI\Editors\CME\Controls\KeywordSelect\KeywordSelectControl.js

Eric gave a good reply on how it can be possibly done in a similar post: http://tridion.stackexchange.com/a/1856/206https://tridion.stackexchange.com/a/1856/206

The extended code will look like:

(function ()
{
    var overridenKeywordSelectControl$_onItemDraw = Tridion.Controls.KeywordSelectControl.prototype._onItemDraw;
    Tridion.Controls.KeywordSelectControl.prototype._onItemDraw = function KeywordSelectControl$_onItemDraw()
    {
        // Call original method
        overridenKeywordSelectControl$_onItemDraw.apply(this);
        

        // Do an action you need
        var element = this.properties.container;
        console.log(element.innerHTML);

        // Or fire event which you can handle elsewhere
        this.fireEvent("extension_oncontroldrawn");
    };
})();

The thing is that Field builder has its field, and in this case “load” event means that field builder is loaded, with the fields, but fields are not loaded by itself.

In case of Keyword field, it uses XSLT transformation to render field view.

Unfortunately Keyword select control does not fire any events which might help in this case. Thus I would suggest to extend _onItemDraw method from \WebUI\Editors\CME\Controls\KeywordSelect\KeywordSelectControl.js

Eric gave a good reply on how it can be possibly done in a similar post: http://tridion.stackexchange.com/a/1856/206

The extended code will look like:

(function ()
{
    var overridenKeywordSelectControl$_onItemDraw = Tridion.Controls.KeywordSelectControl.prototype._onItemDraw;
    Tridion.Controls.KeywordSelectControl.prototype._onItemDraw = function KeywordSelectControl$_onItemDraw()
    {
        // Call original method
        overridenKeywordSelectControl$_onItemDraw.apply(this);
        

        // Do an action you need
        var element = this.properties.container;
        console.log(element.innerHTML);

        // Or fire event which you can handle elsewhere
        this.fireEvent("extension_oncontroldrawn");
    };
})();

The thing is that Field builder has its field, and in this case “load” event means that field builder is loaded, with the fields, but fields are not loaded by itself.

In case of Keyword field, it uses XSLT transformation to render field view.

Unfortunately Keyword select control does not fire any events which might help in this case. Thus I would suggest to extend _onItemDraw method from \WebUI\Editors\CME\Controls\KeywordSelect\KeywordSelectControl.js

Eric gave a good reply on how it can be possibly done in a similar post: https://tridion.stackexchange.com/a/1856/206

The extended code will look like:

(function ()
{
    var overridenKeywordSelectControl$_onItemDraw = Tridion.Controls.KeywordSelectControl.prototype._onItemDraw;
    Tridion.Controls.KeywordSelectControl.prototype._onItemDraw = function KeywordSelectControl$_onItemDraw()
    {
        // Call original method
        overridenKeywordSelectControl$_onItemDraw.apply(this);
        

        // Do an action you need
        var element = this.properties.container;
        console.log(element.innerHTML);

        // Or fire event which you can handle elsewhere
        this.fireEvent("extension_oncontroldrawn");
    };
})();
Source Link
UI Beardcore
  • 2.3k
  • 12
  • 13

The thing is that Field builder has its field, and in this case “load” event means that field builder is loaded, with the fields, but fields are not loaded by itself.

In case of Keyword field, it uses XSLT transformation to render field view.

Unfortunately Keyword select control does not fire any events which might help in this case. Thus I would suggest to extend _onItemDraw method from \WebUI\Editors\CME\Controls\KeywordSelect\KeywordSelectControl.js

Eric gave a good reply on how it can be possibly done in a similar post: http://tridion.stackexchange.com/a/1856/206

The extended code will look like:

(function ()
{
    var overridenKeywordSelectControl$_onItemDraw = Tridion.Controls.KeywordSelectControl.prototype._onItemDraw;
    Tridion.Controls.KeywordSelectControl.prototype._onItemDraw = function KeywordSelectControl$_onItemDraw()
    {
        // Call original method
        overridenKeywordSelectControl$_onItemDraw.apply(this);
        

        // Do an action you need
        var element = this.properties.container;
        console.log(element.innerHTML);

        // Or fire event which you can handle elsewhere
        this.fireEvent("extension_oncontroldrawn");
    };
})();