2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>Dojo Form Widgets Test</title>
|
|
|
6 |
|
|
|
7 |
<script type="text/javascript" src="../../dojo/dojo.js"
|
|
|
8 |
djConfig="isDebug: false, parseOnLoad: true"></script>
|
|
|
9 |
<script type="text/javascript">
|
|
|
10 |
dojo.require("dijit.form.Form");
|
|
|
11 |
dojo.require("dijit.form.ValidationTextBox");
|
|
|
12 |
dojo.require("dijit.form.ComboBox");
|
|
|
13 |
dojo.require("dijit.form.FilteringSelect");
|
|
|
14 |
dojo.require("dijit.form.CheckBox");
|
|
|
15 |
dojo.require("dijit.form.DateTextBox");
|
|
|
16 |
dojo.require("dijit.form.CurrencyTextBox");
|
|
|
17 |
dojo.require("dijit.form.NumberSpinner");
|
|
|
18 |
dojo.require("dijit.form.Slider");
|
|
|
19 |
dojo.require("dijit.form.Textarea");
|
|
|
20 |
dojo.require("dijit.Editor");
|
|
|
21 |
dojo.require("dijit.form.Button");
|
|
|
22 |
dojo.require("dojo.data.ItemFileReadStore");
|
|
|
23 |
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
|
|
|
24 |
|
|
|
25 |
// make dojo.toJson() print dates correctly (this feels a bit dirty)
|
|
|
26 |
Date.prototype.json = function(){ return dojo.date.stamp.toISOString(this, {selector: 'date'});};
|
|
|
27 |
</script>
|
|
|
28 |
<style type="text/css">
|
|
|
29 |
@import "../../dojo/resources/dojo.css";
|
|
|
30 |
@import "../themes/tundra/tundra.css";
|
|
|
31 |
@import "../themes/tundra/tundra_rtl.css";
|
|
|
32 |
@import "../tests/css/dijitTests.css";
|
|
|
33 |
|
|
|
34 |
.formQuestion {
|
|
|
35 |
background-color:#d0e3f5;
|
|
|
36 |
padding:0.3em;
|
|
|
37 |
font-weight:900;
|
|
|
38 |
font-family:Verdana, Arial, sans-serif;
|
|
|
39 |
font-size:0.8em;
|
|
|
40 |
color:#5a5a5a;
|
|
|
41 |
}
|
|
|
42 |
.formAnswer {
|
|
|
43 |
background-color:#f5eede;
|
|
|
44 |
padding:0.3em;
|
|
|
45 |
margin-bottom:1em;
|
|
|
46 |
width: 100%;
|
|
|
47 |
}
|
|
|
48 |
.pageSubContentTitle {
|
|
|
49 |
color:#8e8e8e;
|
|
|
50 |
font-size:1em;
|
|
|
51 |
font-family:Verdana, Arial, sans-serif;
|
|
|
52 |
margin-bottom:0.75em;
|
|
|
53 |
}
|
|
|
54 |
.small INPUT {
|
|
|
55 |
width: 2.5em;
|
|
|
56 |
}
|
|
|
57 |
.medium INPUT {
|
|
|
58 |
width: 10em;
|
|
|
59 |
}
|
|
|
60 |
.long INPUT {
|
|
|
61 |
width: 20em;
|
|
|
62 |
}
|
|
|
63 |
.firstLabel {
|
|
|
64 |
display: inline-block;
|
|
|
65 |
display: -moz-inline-box;
|
|
|
66 |
width: 10em;
|
|
|
67 |
min-width: 10em;
|
|
|
68 |
}
|
|
|
69 |
.secondLabel {
|
|
|
70 |
width: auto;
|
|
|
71 |
margin-left: 5em;
|
|
|
72 |
margin-right: 1em;
|
|
|
73 |
}
|
|
|
74 |
fieldset label {
|
|
|
75 |
margin-right: 1em;
|
|
|
76 |
}
|
|
|
77 |
.noticeMessage {
|
|
|
78 |
display: block;
|
|
|
79 |
float: right;
|
|
|
80 |
font-weight: normal;
|
|
|
81 |
font-family:Arial, Verdana, sans-serif;
|
|
|
82 |
color:#663;
|
|
|
83 |
font-size:0.9em;
|
|
|
84 |
}
|
|
|
85 |
</style>
|
|
|
86 |
</head>
|
|
|
87 |
<body class="tundra">
|
|
|
88 |
<div dojoType="dojo.data.ItemFileReadStore" jsId="stateStore"
|
|
|
89 |
url="../tests/_data/states.json"></div>
|
|
|
90 |
|
|
|
91 |
<h2 class="pageSubContentTitle">Job Application Form</h2>
|
|
|
92 |
<p>This is just a little demo of dijit's form widgets</p>
|
|
|
93 |
<form dojoType="dijit.form.Form" id="myForm" action="showPost.php"
|
|
|
94 |
execute="alert('Execute form w/values:\n'+dojo.toJson(arguments[0],true));">
|
|
|
95 |
<div class="formQuestion">
|
|
|
96 |
<span class="noticeMessage">
|
|
|
97 |
As you type in the text below, notice how your input is auto
|
|
|
98 |
corrected and also the auto completion on the state field.
|
|
|
99 |
</span>
|
|
|
100 |
<span>Name And Address</span>
|
|
|
101 |
</div>
|
|
|
102 |
<div class="formAnswer">
|
|
|
103 |
<label class="firstLabel" for="name">Name *</label>
|
|
|
104 |
<input type="text" id="name" name="name" class="medium"
|
|
|
105 |
dojoType="dijit.form.ValidationTextBox"
|
|
|
106 |
required="true"
|
|
|
107 |
ucfirst="true" invalidMessage=""/>
|
|
|
108 |
<br>
|
|
|
109 |
|
|
|
110 |
<label class="firstLabel" for="address">Address *</label>
|
|
|
111 |
<input type="text" id="address" name="address" class="long"
|
|
|
112 |
dojoType="dijit.form.ValidationTextBox"
|
|
|
113 |
required="true"
|
|
|
114 |
trim="true"
|
|
|
115 |
ucfirst="true" />
|
|
|
116 |
<br>
|
|
|
117 |
|
|
|
118 |
<label class="firstLabel" for="city">City *</label>
|
|
|
119 |
<select dojoType="dijit.form.ComboBox"
|
|
|
120 |
value=""
|
|
|
121 |
autocomplete="true"
|
|
|
122 |
hasDownArrow="false"
|
|
|
123 |
>
|
|
|
124 |
<option></option>
|
|
|
125 |
<option>Chicago</option>
|
|
|
126 |
<option>Los Angeles</option>
|
|
|
127 |
<option>New York</option>
|
|
|
128 |
<option>San Francisco</option>
|
|
|
129 |
<option>Seattle</option>
|
|
|
130 |
</select>
|
|
|
131 |
|
|
|
132 |
<label class="secondLabel" for="state">State</label>
|
|
|
133 |
<input dojoType="dijit.form.FilteringSelect"
|
|
|
134 |
store="stateStore" class="short" id="state" name="state" />
|
|
|
135 |
|
|
|
136 |
<label class="secondLabel" for="zip">Zip *</label>
|
|
|
137 |
<input type="text" id="zip" name="zip" class="medium"
|
|
|
138 |
dojoType="dijit.form.ValidationTextBox"
|
|
|
139 |
trim="true"
|
|
|
140 |
required="true"
|
|
|
141 |
regExp="[0-9][0-9][0-9][0-9][0-9]"
|
|
|
142 |
invalidMessage="5 digit zipcode (ex: 23245)"/>
|
|
|
143 |
<br>
|
|
|
144 |
|
|
|
145 |
<label class="firstLabel" for="dob">DOB *</label>
|
|
|
146 |
<input id="dob" name="dateOfBirth" dojoType="dijit.form.DateTextBox" required=true/>
|
|
|
147 |
|
|
|
148 |
</div>
|
|
|
149 |
|
|
|
150 |
<div class="formQuestion">
|
|
|
151 |
<span class="noticeMessage">Custom checkboxes and radio buttons...</span>
|
|
|
152 |
<span>Desired position</span>
|
|
|
153 |
</div>
|
|
|
154 |
<div class="formAnswer">
|
|
|
155 |
<label class="firstLabel" for="position">Position</label>
|
|
|
156 |
<fieldset id="position" class="dijitInline">
|
|
|
157 |
<input type="checkBox" name="position" id="it" value="it" dojoType="dijit.form.CheckBox" /> <label for="it">IT</label>
|
|
|
158 |
<input type="checkBox" name="position" id="marketing" value="marketing" dojoType="dijit.form.CheckBox" /> <label for="marketing">Marketing</label>
|
|
|
159 |
<input type="checkBox" name="position" id="business" value="business" dojoType="dijit.form.CheckBox" /> <label for="business" style="margin-right: 7em;">Business</label>
|
|
|
160 |
</fieldset>
|
|
|
161 |
|
|
|
162 |
<label class="secondLabel" for="hours">Hours</label>
|
|
|
163 |
<fieldset id="hours" class="dijitInline">
|
|
|
164 |
<input type="radio" name="hours" id="full" value="full" dojoType="dijit.form.RadioButton" /> <label for="full">Full time</label>
|
|
|
165 |
<input type="radio" name="hours" id="part" value="part" dojoType="dijit.form.RadioButton" /> <label for="part">Part time</label>
|
|
|
166 |
</fieldset>
|
|
|
167 |
</div>
|
|
|
168 |
|
|
|
169 |
<div class="formQuestion">
|
|
|
170 |
<span class="noticeMessage">slider and spinner ...</span>
|
|
|
171 |
<span>Education and Experience</span>
|
|
|
172 |
</div>
|
|
|
173 |
<div class="formAnswer">
|
|
|
174 |
<table class="dijitReset">
|
|
|
175 |
<tr>
|
|
|
176 |
<td>
|
|
|
177 |
<label class="firstLabel" for="school">Education level</label>
|
|
|
178 |
</td>
|
|
|
179 |
<td style="padding-left: 2em;">
|
|
|
180 |
<span dojoType="dijit.form.HorizontalSlider" id="school" name="school"
|
|
|
181 |
minimum="1"
|
|
|
182 |
value="2"
|
|
|
183 |
maximum="4"
|
|
|
184 |
discreteValues="4"
|
|
|
185 |
showButtons="false"
|
|
|
186 |
style="width:200px; height: 40px;"
|
|
|
187 |
>
|
|
|
188 |
<span dojoType="dijit.form.HorizontalRule" container="bottomDecoration" count=4 style="height:5px;"></span>
|
|
|
189 |
<ol dojoType="dijit.form.HorizontalRuleLabels" container="bottomDecoration"style="height:1em;font-size:75%;color:gray;">
|
|
|
190 |
<li>high school</li>
|
|
|
191 |
<li>college</li>
|
|
|
192 |
<li>masters</li>
|
|
|
193 |
<li>PhD</li>
|
|
|
194 |
</ol>
|
|
|
195 |
</span>
|
|
|
196 |
</td>
|
|
|
197 |
<td>
|
|
|
198 |
<label class="secondLabel" for="experience">Work experience (years, 0-40)</label>
|
|
|
199 |
</td>
|
|
|
200 |
<td>
|
|
|
201 |
<input dojoType="dijit.form.NumberSpinner"
|
|
|
202 |
id="experience" name="experience"
|
|
|
203 |
value="1"
|
|
|
204 |
constraints="{min: 0, max:40, places:0}"
|
|
|
205 |
size=3>
|
|
|
206 |
</td>
|
|
|
207 |
</tr>
|
|
|
208 |
</table>
|
|
|
209 |
</div>
|
|
|
210 |
|
|
|
211 |
<div class="formQuestion">
|
|
|
212 |
<span class="noticeMessage">Rich text editor that expands as you type in text</span>
|
|
|
213 |
<label for="description">Self description</label>
|
|
|
214 |
</div>
|
|
|
215 |
<div class="formAnswer">
|
|
|
216 |
<textarea dojoType="dijit.Editor" minHeight="5em" id="description" name="description">
|
|
|
217 |
Write a brief summary of <i>your</i> job skills... using <b>rich</b> text.
|
|
|
218 |
</textarea>
|
|
|
219 |
</div>
|
|
|
220 |
|
|
|
221 |
<div class="formQuestion">
|
|
|
222 |
<span class="noticeMessage">Text area that expands as you type in text</span>
|
|
|
223 |
<label for="references">References</label>
|
|
|
224 |
</div>
|
|
|
225 |
<div class="formAnswer">
|
|
|
226 |
<textarea dojoType="dijit.form.Textarea" id="references" name="references">
|
|
|
227 |
Write your references here (plain text)
|
|
|
228 |
</textarea>
|
|
|
229 |
</div>
|
|
|
230 |
|
|
|
231 |
<center>
|
|
|
232 |
<button dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconSave" type=submit>
|
|
|
233 |
OK
|
|
|
234 |
</button>
|
|
|
235 |
</center>
|
|
|
236 |
</form>
|
|
|
237 |
</body>
|
|
|
238 |
</html>
|
|
|
239 |
|