Page 2 of 2

Application is not working in offline mode

Posted: Sat Mar 21, 2015 2:23 pm
by KK

Hi ,
Can you please help me in
1)getting a value from date picker in a variable and then assigning it to a label

2)Getting a value form a label and assigning it to a date picker.

Thanks in advance.

Regards


Application is not working in offline mode

Posted: Wed Mar 25, 2015 4:29 am
by Yurii Orishchuk

Hello,

  1. You can get current date picker component value with following JS code:

    pre

    //Where "mobiledatepicker_2" is your date picker component name.
    var dateValue = Appery("mobiledatepicker_2").attr("defaultDateValue");

    //Set value to "labelName" label.
    Apperyio("labelName").text(dateValue);

    /pre

  2. You can get current text from label and pass it to date picker component with following JS code:

    pre

    //Set value to "labelName" label.
    var dateValue = Apperyio("labelName").text();

    //Where "mobiledatepicker_2" is your date picker component name.
    Appery("mobiledatepicker_2").attr("defaultDateValue", dateValue);

    dateElement.attr("defaultDateValue", "03/22/2015");

    /pre

    Regards.


Application is not working in offline mode

Posted: Wed Mar 25, 2015 10:50 am
by KK

Thanks for your reply.
All this I have searched already and implemented.

My question is still open as other thread:
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 mentioned in both the threads.

Thanks in advance for your help.

Regards


Application is not working in offline mode

Posted: Wed Mar 25, 2015 10:58 pm
by KK

Thanks ,
I got a solution

Regards


Application is not working in offline mode

Posted: Tue Apr 21, 2015 10:57 pm
by Todd Penny

Hello, I am having trouble setting the date for the datepicker component based on the date value I receive from my REST service (and store locall). In fact, I am unable to set the date of the datepicker to any value and have tried about 10 different variations based on this and other support posts.

I can read the default date from the picker using the below example.

The date value returned by the service is called 'datePurchased', is defined as a string and is converted to a date us JS on another screen,so I know that part works. In this case. I am looking to set the datepicker component 'datePurchasedPicker' to the date per the following code which is executed on page load.

//Date Purchased
var dateValue = Appery("datePurchasedPicker").attr("defaultDateValue"); //works
alert(dateValue); //works
Appery("datePurchasedPicker").attr("defaultDateValue", "03/22/2015"); //does not work
dateElement.attr("defaultDateValue", "03/22/2015"); //does not work

Any help appreciated!


Application is not working in offline mode

Posted: Fri Apr 24, 2015 2:42 am
by Yurii Orishchuk

Hi Todd,

It's hard to give you an final solution cause of you did not provide us with format of stored string in your DB.

But you can try following solution:

pre

//This is your date string.
var stringDate = "03/22/2015";

//This is a date JS object.
var date = new Date(stringDate);

//Note: you need to replace "mobiledatepicker_2" with your datepicker component value.
var dateValue = $.datepicker.formatDate(Appery("mobiledatepicker_2").getAttr("dateFormat"), date);

//Note: you need to replace "mobiledatepicker_2" with your datepicker component value.
Appery("mobiledatepicker_2").setAttr("defaultDateValue", dateValue);

/pre

If it will not work for you please specify following things need to help you:

  1. Returned by service date format(actually it's string in your case).

  2. Date format in your date picker. Default is "mm/dd/yy".

    Regards.


Application is not working in offline mode

Posted: Fri Apr 24, 2015 2:55 pm
by Todd Penny

Worked! Thanks for your help.