KK
Posts: 0
Joined: Fri Mar 13, 2015 11:59 pm

Application is not working in offline mode

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Application is not working in offline mode

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.

KK
Posts: 0
Joined: Fri Mar 13, 2015 11:59 pm

Application is not working in offline mode

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

KK
Posts: 0
Joined: Fri Mar 13, 2015 11:59 pm

Application is not working in offline mode

Thanks ,
I got a solution

Regards

Todd Penny
Posts: 0
Joined: Sun Jan 12, 2014 4:29 pm

Application is not working in offline mode

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!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Application is not working in offline mode

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.

Todd Penny
Posts: 0
Joined: Sun Jan 12, 2014 4:29 pm

Application is not working in offline mode

Worked! Thanks for your help.

Return to “Issues”