Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8461443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:52:54+00:00 2026-06-10T13:52:54+00:00

I’m building a Windows 8 Metro app in HTML5/Javascript, and I have several screens

  • 0

I’m building a Windows 8 Metro app in HTML5/Javascript, and I have several screens where users need to fill-in forms.
According to the documentation (http://msdn.microsoft.com/en-us/library/windows/apps/hh700358.aspx) and a few tests, data binding in WinJS seems to be only from the Javascript to the UI.
How can I get what the user typed-in in a Javascript object I could post to the server?

Here’s what I tried so far:

My HTML form:

<div id="createFormDiv" class="hide">
<form id="createForm" onsubmit="return false;">
    <fieldset class="formSection entityForm">
        <legend>Create New Address</legend>
        <table class="fields">                      
            <tr><td>Line 1</td><td><input id="i2" type="text" data-win-bind="value: Line1" /></td></tr>                     
            <tr><td>Line 2</td><td><input id="i3" type="text" data-win-bind="value: Line2" /></td></tr>                     
            <tr><td>City</td><td><input id="i4" type="text" data-win-bind="value: City" /></td></tr>                        
            <tr><td>Zip</td><td><input id="i5" type="text" data-win-bind="value: Zip" /></td></tr>                      
            <tr><td>Country</td><td><input id="i6" type="text" data-win-bind="value: Country" /></td></tr>                      
            <tr><td>Contact</td><td><input id="i7" type="text" data-win-bind="value: Contact" /></td></tr>                                              
        </table>
        <button id="cancelCreateButton" class="button">Cancel</button>
        <button id="createButton" type="submit" class="button">Create</button>
    </fieldset>
</form>

In my JS, I created an empty object which I bound to my form, subscribed to the click event on createButton, and expected to retrieve an object filled-in with the changes.
Here’s the code:

var element = document.getElementById("createFormDiv");
var data = {
    Line1: "",
    Line2: "",
    City: "",
    Zip: "",
    Country: ""
};
WinJS.Binding.processAll(element, data);
_bindingSource = WinJS.Binding.as(data);

And then:

function onCreateCommandClick(args) {
    var Line2 = _bindingSource.getProperty("Line2");
}

Problem is, Line2 property always has its initial value.

Is there a way to retrieve a JavaScript object from an HTML form in WinJS or am I bound to parse each input value individually? If so, what would be the best way?

Thanks,
Carl

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:52:56+00:00Added an answer on June 10, 2026 at 1:52 pm

    Meanwhile here’s what I’m doing:

    var form = document.getElementById("createForm");
    var data = { 
      Line1: form.i2.value, 
      Line2: form.i3.value, 
      City: form.i4.value, 
      Zip: form.i5.value, 
      Country: form.i6.value, 
      Contact: form.i7.value,
    };
    

    This works great as long as you have inputs using the value property.
    For others such as checkboxes or textareas use the appropriate property instead of value (checked for checkbox for instance).

    If anyone has a better solution, I’d love to hear it 🙂

    Hope this helps,
    Carl

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.