Page 1 of 2
How to read the value from a Datepicker?
Posted: Sat Jul 14, 2012 4:40 pm
by Ole Henrik Oftedal
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
How to read the value from a Datepicker?
Posted: Sat Jul 14, 2012 9:17 pm
by maxkatz
This worked:
code
$('input').val();
/code
the code assume you only have one input.
How to read the value from a Datepicker?
Posted: Sun Jul 15, 2012 10:26 am
by Ole Henrik Oftedal
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
How to read the value from a Datepicker?
Posted: Sun Jul 15, 2012 8:31 pm
by maxkatz
Yes, you can do it. Just use a more specific jQuery select to pick that particular input field.
How to read the value from a Datepicker?
Posted: Mon Jul 16, 2012 9:25 am
by Ole Henrik Oftedal
thanks again max.
i'm twisting my head off. i should use the Tiggr function right?
How to read the value from a Datepicker?
Posted: Mon Jul 16, 2012 9:43 am
by aush
if my datepicker is named "dateAb", how do i have to change
$('input').val();
to get the date input?
How to read the value from a Datepicker?
Posted: Mon Jul 16, 2012 4:56 pm
by maxkatz
code
$('input[type="date"]').val();
/code
How to read the value from a Datepicker?
Posted: Mon Jul 16, 2012 9:28 pm
by Ole Henrik Oftedal
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.
How to read the value from a Datepicker?
Posted: Mon Sep 03, 2012 1:34 pm
by Inez Wihardjo
how come my one says undefined?
How to read the value from a Datepicker?
Posted: Mon Sep 03, 2012 2:20 pm
by Ole Henrik Oftedal
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".