Page 1 of 1

Problem with calendarpicker

Posted: Tue Sep 25, 2018 12:11 am
by Freaky_
Hello guys,

I have problem with my calendarpickers. They don't showing date until I select them. Previously they show current date and there was no problem with them.

But from today, my whole code stopped working, because calendarpicker not showing current date, and after select any date - it returns nothing.
Problem exist even on official Metro4 website: Calendarpicker

The pool shows nothing, blank.

Anyone could help?

Re: Problem with calendarpicker

Posted: Tue Sep 25, 2018 12:40 am
by olton
Use value attribute to set init date value for picker

Re: Problem with calendarpicker

Posted: Tue Sep 25, 2018 9:09 am
by Freaky_
The problem is, when I pick another date it returns "undefined".

<input type="text" data-role="calendarpicker" data-format="%e %B %Y" data-on-change="onChange">

function onChange(val, nDate, el)
{
alert(nDate); // Undefined every time
}


It was working before, but stopped suddenly.

Re: Problem with calendarpicker  

Posted: Tue Sep 25, 2018 9:17 am
by olton

Code: Select all

Utils.exec(o.onChange, [that.value], element[0]);
Now event on change receive one argument value and have context input html element

Re: Problem with calendarpicker

Posted: Tue Sep 25, 2018 9:28 am
by Freaky_
Okay, this working perfectly.

var value = $("#datapicker").val();

Thanks for your help!

Re: Problem with calendarpicker

Posted: Tue Sep 25, 2018 12:08 pm
by olton
In 4.2.24
+ [x] Calendar picker: add attribute `data-null-value`. If this attribute false and value empty, used current date