Kamil Janowski
Kamil Janowski

Reputation: 2025

How do I set value of DateTextBox?

So basically I have these two DateTextBoxes and I want to copy the value from one to another? Sounds easy, right? Still, it is not... I tried to do it this way:

dojo.byId("datetextbox1").value = dojo.byId("datetextbox2").value;

it actually looks like the value changes as the content of the field changes, but it doesn't really. When I inspect the element with firefox it still contains the old value in the code and when I try to submit the form, the old value is sent! So my question is: how should I change that damn value?

Upvotes: 4

Views: 4178

Answers (1)

zclark
zclark

Reputation: 813

You'll want to set the value on the widget and not directly on the node.

dijit.byId("datetextbox1").set('value', dijit.byId("datetextbox2").get('value'));

dijit.byId grabs widgets, dojo.byId grabs dom nodes

Upvotes: 3

Related Questions