www.webdeveloper.com
Results 1 to 4 of 4

Thread: easy data binding

  1. #1
    Join Date
    Mar 2012
    Location
    Austria
    Posts
    34

    easy data binding

    Hey,

    is there any way to implement easy data binding using HTML5 and Javascript?

    All I want is to get the value of a text field into a Javascript object, so the following two idea came to my mind:

    Add a custom attribute like data-reference to the <input>-Element which contains a reference to the Javascript object and create an event handler which actually saves the content into the object.

    Is there any chance to do something like this without relying on additional frameworks?

    Thanks in advance!

  2. #2
    Join Date
    Mar 2007
    Location
    Canada
    Posts
    99
    You could do it using a different approach.
    You could have a global JavaScript variable (hash) that contains a key (that's the ID of the element) and the value could be an object.
    To populate that global variable you can use php's json-encode.

  3. #3
    Join Date
    Mar 2012
    Location
    Austria
    Posts
    34
    I haven't considered that, but I tried it... and it works :-) Thanks a lot!

  4. #4
    Join Date
    Mar 2007
    Location
    Canada
    Posts
    99

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles