Page 1 of 1

Datepicker value

Posted: Sat Mar 21, 2015 10:47 pm
by KK

I have 2 datepickers on my page and I am trying to access the value in a variable
name of the datepicker1 = FirstDate
name of the datepicker2 = SecondDate

This is working :
var Date1= $("[name=FirstDate] input").val();

but exactly same thing is not working for second datepicker on the same page:
var Date2= $("[name=SecondDate] input").val();

alert (Date2); -- this gives undefined

I used following options for the second datepicker :
var Date2= $("[name=SecondDate] input").val();
var Date2= Apperyio('SecondDate').getOptions().defaultDate;
var Date2= Appery("SecondDate").getAttr("defaultDateValue");

Can you please explain if there is something else to be added to get the value of the second datepicker.

Thanks.


Datepicker value

Posted: Sat Mar 21, 2015 11:12 pm
by KK

Tried this also and it is also showing value as undefined :

$("[name='SecondDate']").find('input').attr('id','inputStartDate');
var Date2= $("#inputStartDate").val();


Datepicker value

Posted: Sun Mar 22, 2015 11:31 am
by Egor Kotov6832188

Hello KK,

Try next
Apperyio("mobiledatepicker_83").datepicker_dataPickerOptions.defaultDate


Datepicker value

Posted: Sun Mar 22, 2015 11:05 pm
by KK

Thanks for the response :
I tried this as well and its also giving me undefined value :

My Page has 2 datepicker and I am taking both value in variable and displaying the difference in a label.

Issue: first datepicker value is fetched correctly but second one is undefined even when I tried with multiple possibilities.

Here is the code to

//Fetching first datepicker value - working fine
var CDate = $("[name=FirstDayOfLastPeriod] input").val();
$("[name='FirstDayOfLastPeriod']").find('input').attr('id','inputStartDate');
var CDate = $("#inputStartDate").val();
alert (CDate );

//Fetching second datepicker value - not working with same method

var inputdate = $("[name=WeekOnThisDate] input").val();
$("[name='WeekOnThisDate']").find('input').attr('id','inputStartDate');
var inputdate = $("#inputStartDate").val();

alert (inputdate);

var User = Appery('lbluser').text();

var inputdate1 = new Date(CDate);
var l1 = inputdate1.getDate();
var m1 = inputdate1.getMonth();
var n1= inputdate1.getFullYear();

var ConvertInput1= new Date(n1, m1, l1);

var Timesince1970andInput1= ConvertInput1.getTime();

var inputdate2 = new Date(inputdate);
var l2 = inputdate2.getDate();
var m2 = inputdate2.getMonth();
var n2= inputdate2.getFullYear();

var ConvertInput2= new Date(n2, m2, l2);

var Timesince1970andInput2= ConvertInput2.getTime();

var RemainingWeeksTime = Timesince1970andInput2 - Timesince1970andInput1;

var RemainingWeeks = Math.round(RemainingWeeksTime/604800000);

var result= "On " + inputdate +" Total Week = " + RemainingWeeks ;

Appery('mobilelabel_28').text(result);

Can you please tell me what is wrong and why second datepicker value is undefined always.

Regards


Datepicker value

Posted: Mon Mar 23, 2015 9:07 pm
by KK

Can someone please reply


Datepicker value

Posted: Tue Mar 24, 2015 1:54 pm
by Alena Prykhodko

Hello,

Sorry for delay here.
We'll get back with answer as soon as possible.


Datepicker value

Posted: Wed Mar 25, 2015 5:07 am
by Yurii Orishchuk

Hello,

Please check your other thread about same issue.

https://getsatisfaction.com/apperyio/...

Regards.