Open new webpage from a button

Hi,

 

I am trying to open a new webpage from a button onclick action. I saw this feed:

https://community.creatio.com/questions/how-open-new-webpage-button-onc…

 

I'm very new in Creation so I tried to replicate it on a page definition. What's wrong with the following code:

 

define("UsrPage_bwxynuo", /**SCHEMA_DEPS*/[]/**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/()/**SCHEMA_ARGS*/ {

    return {

        methods: {

            openWindow: function() {

                 var path = this.get("https://fr.wikipedia.org");

                 window.open(path, '_blank');

             }

        },

        viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[

            {

                "operation": "insert",

                "name": "Button_w36eyol",

                "values": {

                    "itemType": Terrasoft.ViewItemType.BUTTON,

                    "click": {"bindTo": "openWindow"},

                },

                "parentName": "MainContainer",

                "propertyName": "items",

                "index": 0

            }

        ]/**SCHEMA_VIEW_CONFIG_DIFF*/,

        viewModelConfig: /**SCHEMA_VIEW_MODEL_CONFIG*/{}/**SCHEMA_VIEW_MODEL_CONFIG*/,

        modelConfig: /**SCHEMA_MODEL_CONFIG*/{}/**SCHEMA_MODEL_CONFIG*/,

        handlers: /**SCHEMA_HANDLERS*/[]/**SCHEMA_HANDLERS*/,

        converters: /**SCHEMA_CONVERTERS*/{}/**SCHEMA_CONVERTERS*/,

        validators: /**SCHEMA_VALIDATORS*/{}/**SCHEMA_VALIDATORS*/

    };

});

Like 0

Like

2 comments
Best reply

Hello,

From the code you posted, you're using the newer type of page (Freedom UI), but how you wired up the click of the button to call your method is how you do this on the older classic pages. To wire up the click of your button execute your own code, see this article: https://customerfx.com/article/adding-a-button-to-execute-custom-code-o…

Ryan

Hello,

From the code you posted, you're using the newer type of page (Freedom UI), but how you wired up the click of the button to call your method is how you do this on the older classic pages. To wire up the click of your button execute your own code, see this article: https://customerfx.com/article/adding-a-button-to-execute-custom-code-o…

Ryan

Thank you very much Ryan

Show all comments