Counter Bug inside a window

Hi Guys,

I’m trying to insert a counter inside a window with a start value, but when a insert a name property in this counter the start value returns to 0. Why?

For example:

In this example: Windows: Form inside

If a change the code like below the counter shows 0, not 550:

		var form = {
			view:"form",
			borderless:true,
			elements: [
				{ view:"text", label:'Login', name:"login" },
				{ view:"text", label:'Email', name:"email" },
                { view:"counter", label:"First age", value: 550, name: "myCounter"},
				{ view:"button", value: "Submit", click:function(){
					if (this.getParentView().validate()){ //validate form
                        webix.message("All is correct");
                        this.getTopParentView().hide(); //hide window
                    }
					else
						webix.message({ type:"error", text:"Form data is invalid" });
				}}
			],
			rules:{
				"email":webix.rules.isEmail,
				"login":webix.rules.isNotEmpty
			},
			elementsConfig:{
				labelPosition:"top",
			}
		};

Please someone can help me?

Thanks for all,
Cheers,

Hello,

So far we could not spot the problem: http://webix.com/snippet/b0d84b5a

Could you please change the snippet to demonstrate the issue?

Hi,

Sorry for the late reply! :slight_smile:

I think that I found the problem. This is the snippet:

http://webix.com/snippet/13ea0fef

The problem is with this line:

$$("myWindow").getBody().clear();

This line clear all fields, but it remove the predefined values too. This happen with others components too, like slider and text.

Cheers,

That’s an expected behavior. The form’s clear()method clears the values of the fields.

To get back to the predefined values, you need to use the following code:

var values = $$("myWindow").getBody().getCleanValues();
$$("myWindow").getBody().setValues(values); 

Oh, Thanks Helga!
My Bad… :slight_smile: