Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

How to read the value from a Datepicker?

Hi!

How can I read the selected date from a DatePicker?

I've tried this from an on click event:

var input = Tiggr('Mydatepicker');
alert (input.datepicker( "getDate" ));

(nothing happens)

Also tried two example found on this forum but i cannot get it to work.
(based on Attr() / Val() )

best regards

Ole H. Oftedal
Timeflex Systemer AS
http://www.timeflex.com
http://www.timeflex.no

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to read the value from a Datepicker?

This worked:

code
$('input').val();
/code

the code assume you only have one input.

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

How to read the value from a Datepicker?

Thanks for fast reply!

There are four or five input fields on the form.

They are all normal text input.

Is it possible to get only the Date field input?

best regards

Ole H. Oftedal
Timeflex Systemer AS
http://www.timeflex.com
http://www.timeflex.no

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to read the value from a Datepicker?

Yes, you can do it. Just use a more specific jQuery select to pick that particular input field.

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

How to read the value from a Datepicker?

thanks again max.
i'm twisting my head off. i should use the Tiggr function right?

aush
Posts: 0
Joined: Thu Jul 12, 2012 2:01 pm

How to read the value from a Datepicker?

if my datepicker is named "dateAb", how do i have to change
$('input').val();
to get the date input?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to read the value from a Datepicker?

code
$('input[type="date"]').val();
/code

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

How to read the value from a Datepicker?

Nice! Works perfect.
Little strange when using by type and not by name but thats ok for me.

Now I can send the date value into my REST service without problems.

Hope JQUERY also comes with a timepicker some day. This will make my App even more user friendly.

Thank you so much for great service/support.

Inez Wihardjo
Posts: 0
Joined: Thu Aug 30, 2012 3:33 pm

How to read the value from a Datepicker?

how come my one says undefined?

Ole Henrik Oftedal
Posts: 0
Joined: Thu Apr 19, 2012 4:52 pm

How to read the value from a Datepicker?

Hi!

Take a look at this thread:

https://getsatisfaction.com/tiggzi/to...

It is no longer of type "date". In the latest version it is of type "text".

Return to “Issues”