Debian Codegraph @

dojox/mvc/tests/test_new-mvc_input-output-simple.html

raw symbols SCIP
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
11 <script type="text/javascript" data-dojo-config="parseOnLoad:0,isDebug:1,async:1,mvc:{debugBindings:1}"
12 src="../../../dojo/dojo.js"></script>
13 <script type="text/javascript">
14 var model;
15
16 require([
17 'dojo/parser',
18 'dojo/ready',
19 'dojox/mvc',
20 'dijit/form/TextBox',
21 'dijit/form/Button',
22 'dojox/mvc/Group',
23 'dojox/mvc/Output'
24 ], function(parser, ready, mvc){
25
26 // The dojox.mvc.StatefulModel class creates a data model instance
27 // where each leaf within the data model is decorated with dojo.Stateful
28 // properties that widgets can bind to and watch for their changes.
29 model = mvc.newStatefulModel({ data : { "First" : "John", "Last" : "Doe", "Email" : "[email protected]" }});
30 // the StatefulModel created above is initialized with
31 // model.First set to "John", model.Last set to "Doe" and model.Email set to "[email protected]"
32
33 // when "dojo/ready" is ready call parser.parse
34 ready(function(){
35 parser.parse();
36 });
37 });
38 </script>
39 </head>
40 <body class="claro">
41 <script type="dojo/require">at: "dojox/mvc/at"</script>
42 <div id="wrapper">
43 <div id="header">
44 <div id="navigation"></div>
45 <div id="headerInsert">
46 <h1>Input Output Sync</h1>
47 <h2>Data Binding Example</h2>
48 </div>
49 </div>
50 <div id="main">
51 <div id="leftNav"></div>
52 <div id="mainContent">
53 <div class="row">
54 <label class="cell" for="firstnameInput">First:</label>
55 <input class="cell" id="firstnameInput" data-dojo-type="dijit.form.TextBox"
56 data-dojo-props="value: at(model.First, 'value')"></input>
57 <!-- Content in output below will always be in sync with value of textbox above -->
58 <span data-dojo-type="dojox.mvc.Output" data-dojo-props="value: at(model.First, 'value')">
59 (first name is: ${this.value})
60 </span>
61 </div>
62 <div class="row">
63 <label class="cell" for="lastnameInput">Last:</label>
64 <input class="cell" id="lastnameInput" data-dojo-type="dijit.form.TextBox"
65 data-dojo-props="value: at(model.Last, 'value')"></input>
66 <span data-dojo-type="dojox.mvc.Output" data-dojo-props="value: at(model.Last, 'value')">
67 (last name is: ${this.value})
68 </span>
69 </div>
70 <div class="row">
71 <label class="cell" for="emailInput">Email:</label>
72 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox"
73 data-dojo-props="value: at(model.Email, 'value')"></input>
74 <span data-dojo-type="dojox.mvc.Output" data-dojo-props="value: at(model.Email, 'value')">
75 (email is: ${this.value})
76 </span>
77 </div>
78 <br/>Model:
79 <button id="reset" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){model.reset();}">Reset</button>
80 </div>
81 </div>
82 </div>
83 </body>
84 </html>