Debian Codegraph @

dojox/mvc/tests/controllers/step1_test_mvc.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>Step 1 of test for Controllers, use getStateful() only.</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" data-dojo-config="parseOnLoad:0,isDebug:1,async:1,mvc:{debugBindings:1}" src="../../../../dojo/dojo.js"></script>
11 <script type="text/javascript">
12 var model;
13
14 require([
15 'dojo/parser',
16 'dojo/ready',
17 'dojox/mvc/getStateful',
18 'dojox/mvc/parserExtension', // required for data-mvc-bindings to bind to non-widgets
19 'dijit/form/TextBox',
20 'dijit/form/Button',
21 'dojox/mvc/Group',
22 'dojox/mvc/Output'
23 ], function(parser, ready, getStateful){
24
25 // Initial data
26 var data = {
27 "id" : "360324",
28 "FullName" : "Mr. John Doe",
29 "Email" : "[email protected]",
30 "AddressLine1" : "123 Valley Rd.",
31 "AddressLine2" : "",
32 "City" : "Cary",
33 "State" : "NC",
34 "Zip" : "27513"
35 };
36
37 transformAddress2Class = {
38 format: function(value){
39 if(value && value.trim().length > 0){
40 return "row" // if AddressLine2 is set return row for class
41 }
42 return "hiderow"; // if AddressLine2 is not set return hiderow for class
43 }
44
45 };
46
47 // The getStateful call will take json data and make it Stateful
48 //
49 // In this example a transform (transformAddress2Class) is used to hide the row for AddressLine2 if it is blank.
50 // 'dojox/mvc/parserExtension' is required for this since the row being hidden is not a widget.
51 // The class attribute is bound to AddressLine2 with a direction and a transform.
52 //
53 model = getStateful(data);
54
55 parser.parse();
56 });
57 </script>
58 </head>
59 <body class="claro">
60 <script type="dojo/require">at: "dojox/mvc/at"</script>
61 <div id="wrapper">
62 <div id="main">
63 <div>
64 <h2>Step 1 of test for Controllers, use getStateful() only.</h2>
65 <h2>Enter Shipping Address</h2>
66 </div>
67 <div class="fullrow" data-dojo-type="dojox/mvc/Group" data-dojo-props="target: at(model)">
68 <div class="fullrow">
69 <label class="cell" for="nameInput">Full Name:</label>
70 <input class="cell" id="nameInput" data-dojo-type="dijit/form/TextBox"
71 data-dojo-props="value: at('rel:', 'FullName')">
72 </div>
73 <div class="fullrow">
74 <label class="cell" for="AddressLine1Input">Address Line1:</label>
75 <input class="cell" id="AddressLine1Input" data-dojo-type="dijit/form/TextBox"
76 data-dojo-props="value: at('rel:', 'AddressLine1')">
77 </div>
78 <div class="fullrow">
79 <label class="cell" for="AddressLine2Input">Address Line2:</label>
80 <input class="cell" id="AddressLine2Input" data-dojo-type="dijit/form/TextBox"
81 data-dojo-props="value: at('rel:', 'AddressLine2')">
82 </div>
83 <div class="fullrow">
84 <label class="cell" for="cityInput">City:</label>
85 <input class="cell" id="cityInput" data-dojo-type="dijit/form/TextBox"
86 data-dojo-props="value: at('rel:', 'City')">
87 </div>
88 <div class="fullrow">
89 <label class="cell" for="stateInput">State:</label>
90 <input class="cell" id="stateInput" data-dojo-type="dijit/form/TextBox"
91 data-dojo-props="value: at('rel:', 'State')">
92 </div>
93 <div class="fullrow">
94 <label class="cell" for="zipInput">Zipcode:</label>
95 <input class="cell" id="zipInput" data-dojo-type="dijit/form/TextBox"
96 data-dojo-props="value: at('rel:', 'Zip')">
97 </div>
98 </div>
99 <br/>
100 <div>
101 <h2>Verify the shipping address</h2>
102 </div>
103 <div class="fullrow" data-dojo-type="dojox/mvc/Group" data-dojo-props="target: at(model)">
104 <div class="fullrow">
105 <div class="boldnamecell" data-dojo-type="dojox/mvc/Output"
106 data-dojo-props="value: at('rel:', 'FullName')"></div>
107 </div>
108 <div class="fullrow">
109 <div class="namecell" data-dojo-type="dojox/mvc/Output"
110 data-dojo-props="value: at('rel:', 'AddressLine1')"></div>
111 </div>
112 <div class="hiderow" data-mvc-bindings="class: at('rel:', 'AddressLine2').direction(at.from).transform(transformAddress2Class)">
113 <div class="namecell" data-dojo-type="dojox/mvc/Output"
114 data-dojo-props="value: at('rel:', 'AddressLine2')"></div>
115 </div>
116 <div class="fullrow">
117 <div class="namecell" data-dojo-type="dojox/mvc/Output"
118 data-dojo-props="value: at('rel:', 'City')">${this.value},</div>
119 <div class="namecell" data-dojo-type="dojox/mvc/Output"
120 data-dojo-props="value: at('rel:', 'State')"></div>
121 <div class="namecell" data-dojo-type="dojox/mvc/Output"
122 data-dojo-props="value: at('rel:', 'Zip')"></div>
123 </div>
124 </div>
125 </div>
126 </div>
127 </body>
128 </html>