1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
---|
5 | <title>Simple Input-Output Data Binding Example</title> |
---|
6 | <style type="text/css"> |
---|
7 | @import "css/app-format.css"; |
---|
8 | @import "../../../dijit/themes/claro/claro.css"; |
---|
9 | </style> |
---|
10 | <script type="text/javascript"> |
---|
11 | require = { |
---|
12 | parseOnLoad: 0, |
---|
13 | isDebug: 1, |
---|
14 | async: 1, |
---|
15 | mvc: {debugBindings: true} |
---|
16 | }; |
---|
17 | </script> |
---|
18 | <script type="text/javascript" src="../../../dojo/dojo.js"></script> |
---|
19 | <script type="text/javascript"> |
---|
20 | require([ |
---|
21 | "dojo/parser", |
---|
22 | "dojo/Stateful", |
---|
23 | "dijit/form/Button", |
---|
24 | "dijit/form/TextBox", |
---|
25 | "dojo/domReady!" |
---|
26 | ], function(parser, Stateful){ |
---|
27 | model = new Stateful({First: "John", Last: "Doe", Email: "jdoe@example.com"}); |
---|
28 | parser.parse(); |
---|
29 | }); |
---|
30 | </script> |
---|
31 | </head> |
---|
32 | <body class="claro"> |
---|
33 | <script type="dojo/require">at: "dojox/mvc/at"</script> |
---|
34 | <div id="wrapper"> |
---|
35 | <div id="header"> |
---|
36 | <div id="navigation"></div> |
---|
37 | <div id="headerInsert"> |
---|
38 | <h1>Input Ouput Sync</h1> |
---|
39 | <h2>Data Binding Example</h2> |
---|
40 | </div> |
---|
41 | </div> |
---|
42 | <div id="main"> |
---|
43 | <div id="leftNav"></div> |
---|
44 | <div id="mainContent"> |
---|
45 | <div class="row"> |
---|
46 | <label class="cell" for="firstnameInput">First:</label> |
---|
47 | <input class="cell" id="firstnameInput" data-dojo-type="dijit.form.TextBox" |
---|
48 | data-dojo-props="value: at(model, 'First')"> |
---|
49 | <!-- Content in output below will always be in sync with value of textbox above --> |
---|
50 | (first name is: <span data-dojo-type="dijit._WidgetBase" |
---|
51 | data-dojo-props="_setValueAttr: {node: 'domNode', type: 'innerText'}, |
---|
52 | value: at(model, 'First')"></span>) |
---|
53 | </div> |
---|
54 | <div class="row"> |
---|
55 | <label class="cell" for="lastnameInput">Last:</label> |
---|
56 | <input class="cell" id="lastnameInput" data-dojo-type="dijit.form.TextBox" |
---|
57 | data-dojo-props="value: at(model, 'Last')"> |
---|
58 | (last name is: <span data-dojo-type="dijit._WidgetBase" |
---|
59 | data-dojo-props="_setValueAttr: {node: 'domNode', type: 'innerText'}, |
---|
60 | value: at(model, 'Last')"></span>) |
---|
61 | </div> |
---|
62 | <div class="row"> |
---|
63 | <label class="cell" for="emailInput">Email:</label> |
---|
64 | <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" |
---|
65 | data-dojo-props="value: at(model, 'Email')"> |
---|
66 | (email is: <span data-dojo-type="dijit._WidgetBase" |
---|
67 | data-dojo-props="_setValueAttr: {node: 'domNode', type: 'innerText'}, |
---|
68 | value: at(model, 'Email')"></span>) |
---|
69 | </div> |
---|
70 | </div> |
---|
71 | </div> |
---|
72 | </div> |
---|
73 | </body> |
---|
74 | </html> |
---|