locked
How to get Calendar date to show up from eventInfo

    Question

  • So I know we can get the information shown from a rating by having a line like:

    ratingOutput.innerText = "You've rated this " + eventInfo.detail.tentativeRating;

    I can't seem to figure out or find how to show information from a calendar in the same way? I assumed since this was the example used during the tutorial that eventInfo.detail.etc would be the standard way to do this, but I'm thinking it's not. 

    So if I had:

    datePicked.innerText = "You've chosen the date " + <!--HERE-->;

    What goes in the comment to have the date chosen selected?
    Thursday, February 21, 2013 9:30 PM

Answers

  • Hi ZachAtttack,

    For WinJS controls, each one has its own UI behavior and properties/options. for rating control, you can set rating value on it and let it display the current rating value. For DatePicker, it is used for you to select a date and the selected date is just shown with the year,month,date dropdown boxes. You can check all the available properties and events via the msdn reference:


    #WinJS.UI.DatePicker object (Windows)
    http://msdn.microsoft.com/en-us/library/windows/apps/br211681.aspx


    If you want to show the selected date of the DatePicker control (such as after the change event fired), you need to add code in the event to get the current value ( using datepicker.current property) and assign it to some other UI elements (such as a <label> or <div>'s innerText). Or you can even use some flyout windows to show a popup window to notify the selected value:


    #Quickstart: adding a Flyout(Windows Store apps using JavaScript and HTML) (Windows)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh465354.aspx


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Wednesday, February 27, 2013 10:44 AM
    Monday, February 25, 2013 8:54 AM
    Moderator

All replies

  • What is the event you're attached to for the date picker?
    Friday, February 22, 2013 2:54 AM
  • change

    code:

    var dateChosen = document.getElementById("calendar");
    var datePicker = dateChosen.winControl;
    datePicker.addEventListener("change", dateChoice, false);

    I'm getting something to pop-up, I just don't know how to get the date to show. For example, I tried eventInfo.srcElement; But that only gets me:

    [Object HTMLSelectElement]

    • Edited by ZachAtttack Friday, February 22, 2013 3:32 PM
    Friday, February 22, 2013 3:30 PM
  • Hi ZachAtttack,

    For WinJS controls, each one has its own UI behavior and properties/options. for rating control, you can set rating value on it and let it display the current rating value. For DatePicker, it is used for you to select a date and the selected date is just shown with the year,month,date dropdown boxes. You can check all the available properties and events via the msdn reference:


    #WinJS.UI.DatePicker object (Windows)
    http://msdn.microsoft.com/en-us/library/windows/apps/br211681.aspx


    If you want to show the selected date of the DatePicker control (such as after the change event fired), you need to add code in the event to get the current value ( using datepicker.current property) and assign it to some other UI elements (such as a <label> or <div>'s innerText). Or you can even use some flyout windows to show a popup window to notify the selected value:


    #Quickstart: adding a Flyout(Windows Store apps using JavaScript and HTML) (Windows)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh465354.aspx


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Wednesday, February 27, 2013 10:44 AM
    Monday, February 25, 2013 8:54 AM
    Moderator