-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello! I've a form with two dates, and I wanto to insert a constrait on them: the second date must be grater than the first date. I want to do this client side but I've no idea how get the values inserted in dateboxes. This is my code:
...
<datebox id="fromDate" format="short" constraint="no past" value="@bind(myVM.fromDate)"></datebox>
<datebox format="short" constraint="no past" value="@bind(myVM.toDate)"
w:onChange="changeDate();"></datebox>
...
<script type="text/javascript">
function changeDate() {
var x = jq('$toDate');
...???...
}
</script>
How can I get the date value from x? Very thanks...
either way is the same.
jq('$db').zk.$().getValue()
// or
zk('$db').$().getValue();
Hello greendragon,
Here is the respective with timebox:
<zk xmlns:w="client">
<timebox
id="dbx"
w:onClick="
var origin = zk.Widget.$('$dbx');
var t = zk.Widget.$('$dbx2');
t.$n('real').value=( origin.$n('real').value );
t.updateChange_();" />
<timebox id="dbx2" />
</zk>
You had to change the component, and use the onClick event in order to make it work.
Best Regards,
Darksu
Hello! I solved the problem with the datebox:
var toDate = new Date(jq('$toDate').zk.$().getValue());
Thanks
Thanks! Both the answers are working!
Hello greendragon,
Please use the following code in order to update the second datebox with the value from the first one:
<zk xmlns:w="client">
<datebox
id="dbx"
w:onChange="
var origin = zk.Widget.$('$dbx');
var t = zk.Widget.$('$dbx2');
t.$n('real').value=( origin.$n('real').value );
t.updateChange_();" />
<datebox id="dbx2" />
</zk>
Best Regards,
Darksu
Asked: 2015-10-08 13:51:23 +0800
Seen: 58 times
Last updated: Oct 14 '15