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

I am going to set input's value to a text element when button is clicked? How can i do that?

define("ContactPageV2", [], function() {
	return {
		entitySchemaName: "Contact",
		attributes: {},
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		methods: {
			onPageClick: function() {
				var GreetingValue = this.get("SalutationType").value;
				var GreetingDisplayValue = this.get("SalutationType").displayValue;
 
 
				console.log(GreetingDisplayValue);
			},
			getMyButtonEnabled: function(){
				return true;
			}
		},
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",	
				"parentName": "ContactGeneralInfoBlock",
				"propertyName": "items",
				"name": "NewButton",
				"values": {
					itemType: Terrasoft.ViewItemType.BUTTON,
                    caption: {bindTo: "Resources.Strings.NewButtonCaption"},
					click: {bindTo: "onPageClick"},
					enabled: {bindTo: "getMyButtonEnabled"},
					"style": Terrasoft.controls.ButtonEnums.style.BLUE,
					"layout": {
						"column": 12,
						"row": 2,
						"colSpan": 8,
						"rowSpan": 1
					}
 
				},
 
            },
			{
				"operation": "insert",	
				"parentName": "ContactGeneralInfoBlock",
				"propertyName": "items",
				"name": "NewInput",
				"values": {
					itemType: Terrasoft.utils.inputBox,
                    caption: {bindTo: "Resources.Strings.NewButtonCaption"},
					click: {bindTo: "onPageClick"},
					enabled: {bindTo: "getMyButtonEnabled"},
					"style": Terrasoft.controls.ButtonEnums.style.BLUE,
					"layout": {
						"column": 6,
						"row": 3,
						"colSpan": 8,
						"rowSpan": 1
					}
 
				},
			}
		]/**SCHEMA_DIFF*/
	};
});

 

Like 0

Like

3 comments
Best reply

You can do it by using this.set("StringColumn", valueNeeded); in the click-handler function for your button.

 

Best regards,

Oscar

You can do it by using this.set("StringColumn", valueNeeded); in the click-handler function for your button.

 

Best regards,

Oscar

Oscar Dylan,

thanks i will try it

 

Oscar Dylan,

how can i get innertext or innerhtml of something?

 

Show all comments



Hi community,

Its possible when i click a field on a dashboard(view) display another view with another information?

King regards!

Like 0

Like

1 comments

Unfortunately, there is no such functionality in out-of-the-box system.

Show all comments