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