locked
How read checkbox or radio button state from another page in a navigator template?

    Question

  • I'm writing a Windows Store app using the navigator template available in Visual Studio 2013 and quickly hit a wall. In one of the html pages there are some radio buttons and checkboxes used by the code (.js file) of another html page to perform some tasks.

    This is a Windows version of an HTML5/JS iOS/Android app. In those platforms that's not a problem 'cause there are no separate html pages, they are built as single-page-applications with divs working as the separate views. Windows Store apps are different (the navigator app for instance) where there are separate html pages, so DOM elements aren't accessible from the "document", so question is how to access these checkboxes and radio buttons from a different page.

    Your help will be appreciated.

    Thursday, February 6, 2014 10:06 PM

Answers

  • Hi Brickyenne,

    Basically when Windows Store App for HTML navigates to another page, current page will be destroyed, for this reason I don't think you could read any state from previous page.

    But you could still passing the value from the page to page.

    WinJS.Navigation.navigate("/pages/secondpage.html", yourvalue);

    Or try to saving your states in local/temp storage could also be a solution, take a look at this http://msdn.microsoft.com/en-us/library/windows/apps/br229774.aspx#objects_section

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Brickyenne Friday, February 7, 2014 4:02 PM
    Friday, February 7, 2014 2:11 AM
    Moderator

All replies

  • Hi Brickyenne,

    Basically when Windows Store App for HTML navigates to another page, current page will be destroyed, for this reason I don't think you could read any state from previous page.

    But you could still passing the value from the page to page.

    WinJS.Navigation.navigate("/pages/secondpage.html", yourvalue);

    Or try to saving your states in local/temp storage could also be a solution, take a look at this http://msdn.microsoft.com/en-us/library/windows/apps/br229774.aspx#objects_section

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Brickyenne Friday, February 7, 2014 4:02 PM
    Friday, February 7, 2014 2:11 AM
    Moderator
  • Hello James,

    Thank you for the reply. Yep you're right, I'm looking into saving the value to local storage and retrive it that way.

    Thank you.

    Alfredo.

    Friday, February 7, 2014 4:06 PM