Change Label text dynamically

Hi,

I have enjoyed many wonderful features of DHTMLX touch, but I could simply not able to change label text dynamically. Below my code:

$$(“welcomeText”).label=“Account”;

But it did not change the label text.

Appreciate your help.

Thanks!

Try to use

$$(“welcomeText”).config.label=“Account”; //change value
$$(“welcomeText”).refresh(); //force repainting

That was exactly what I did, but it doesnt work :frowning:

Please check the attached sample.
03_buttons.zip (688 Bytes)

Thanks for your attachment.

Found the culprit. $$(‘form’).setValues () have overidden everything I set previously.
The problem with dhtmlx is it save everything in your form, including label. So when applying the values, it also set all your labels.

form will map values to elements by their name or id attribute.
So, you need to define unique id for the label element, or just not define it at all - in such case label will not be affected by form’s data.

I really want to exclude label in form submission. But if I remove id, how can I refer to the label? I still need to change value of label programatically, eg. $$(“welcomeText”).setValue (‘Welcome’);

Thanks for your help.

You can redefine getValues method for form in question as

$$('myform').getValues = function(){ for (var name in this.elements) if (this.elements[name].name != "label") data[name] = this.elements[name].getValue(); return data; };