Guest User

Untitled

a guest
Nov 29th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.45 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Form example</title>
  4. <style>
  5. body {
  6. margin: 1em auto;
  7. max-width: 60em;
  8. }
  9. form {
  10. width: 60%;
  11. max-width: 30em;
  12. }
  13. .messages {
  14. width: 60%;
  15. max-width: 30em;
  16. }
  17. fieldset {
  18. border: 1px solid #ccc;
  19. border-radius: 3px;
  20. margin-bottom: 1em;
  21. }
  22. fieldset div {
  23. float: left;
  24. width: 100%;
  25. padding: 0.5em 0;
  26. }
  27. fieldset div.half {
  28. float: left;
  29. width: 50%;
  30. }
  31. fieldset div.medium {
  32. float: left;
  33. width: 75%;
  34. }
  35. fieldset div.half label,
  36. fieldset div.half input,
  37. fieldset div.medium label,
  38. fieldset div.medium input {
  39. float: left;
  40. clear: both;
  41. }
  42. fieldset div.small {
  43. float: left;
  44. width: 25%;
  45. }
  46. fieldset div label,
  47. fieldset div input {
  48. width: 95%;
  49. }
  50. fieldset div p {
  51. margin-top: 0.5em;
  52. }
  53. div.inline label,
  54. div.inline input,
  55. div.inline select {
  56. display: inline;
  57. float: none;
  58. clear: none;
  59. width: auto;
  60. }
  61. .fieldset-full label,
  62. .fieldset-full input,
  63. .fieldset-full select,
  64. .fieldset-full textarea {
  65. float: left;
  66. clear: both;
  67. width: 100%;
  68. }
  69. .customclass {
  70. background: #eee;
  71. padding: 0.5em 5%;
  72. width: 90%;
  73. }
  74. .labelclass{
  75. color: #33a;
  76. }
  77. .inputclass {
  78. color: #0a0;
  79. }
  80. .has-validation-error {
  81. color: #f00;
  82. }
  83. span.required {
  84. color: #f00;
  85. }
  86. .custombutton {
  87. background-color: #aae;
  88. }
  89. .validation,
  90. .message {
  91. background-color: #bbf;
  92. color: #33f;
  93. border: 1px solid #33f;
  94. padding: 0.5em;
  95. }
  96. .success {
  97. background-color: #bfb;
  98. color: #3a3;
  99. border: 1px solid #3a3;
  100. }
  101. .warning {
  102. background-color: #ffb;
  103. color: #aa3;
  104. border-color: #aa3;
  105. }
  106. .error {
  107. background-color: #fbb;
  108. color: #f33;
  109. border-color: #f33;
  110. }
  111. </style>
  112. </head>
  113. <body>
  114.  
  115. <h1>Boilerplate form.</h1>
  116.  
  117. <p>This form has a prefix that is displayed before any form messages.</p>
  118.  
  119. <div class="messages">
  120. <p class="message">Neutral messages should be displayed before the form.</p>
  121. <p class="message success">Success messages should be displayed before the form.</p>
  122. <p class="message warning">Warning messages should be displayed before the form.</p>
  123. <p class="message error">Error messages should be displayed before the form.</p>
  124. </div>
  125.  
  126. <form action="" method="post" name="formname">
  127. <h2>Real world form elements.</h2>
  128.  
  129. <p>In the form element there is also an introduction.
  130. Sometimes you might want to <a href="#anchortarget">jump to a step</a> in the form.
  131. So simple HTML elements like links must be allowed.</p>
  132.  
  133. <fieldset id="textfields" class="fieldset-full">
  134. <legend>Different textfield options</legend>
  135.  
  136. <div>
  137. <label for="textfield1">Textfield with placeholder</label>
  138. <input type="text" name="textfield-placeholder" id="textfield1"
  139. placeholder="Textfield placeholder" class="inputclass">
  140. </div>
  141.  
  142. <div class="customclass">
  143. <label for="textfieldclasses" class="labelclass">Textfield with .labelclass</label>
  144. <input type="text" name="textfieldclasses" class="inputclass"
  145. id="textfieldclasses" value="Input textfield with .inputclass">
  146. <p>Labels, rows and input elements need separate class definitions.
  147. This is to enable visual distinctions that are sometimes required.</p>
  148. </div>
  149.  
  150. <div class="has-validation-error">
  151. <label for="textfielderror">Textfield with error</label>
  152. <input type="text" name="textfield-error" class="has-validation-error"
  153. id="textfielderror" value="Wrong textfield value">
  154. <div>
  155. <p class="validation error">If an error was detected by the validation,
  156. an inline message must be displayed.</p>
  157. </div>
  158. </div>
  159.  
  160. <div>
  161. <label for="textfield2">Textfield with default value</label>
  162. <input type="text" name="textfield-default" id="textfield2"
  163. value="Textfield default" maxlength="20">
  164. <p>An explanation text about what the <b>default value</b> means.
  165. This explanation needs HTML tags for emphasis and clarity.</p>
  166. </div>
  167.  
  168. <div>
  169. <label for="textfield3">Disabled textfield</label>
  170. <input type="text" name="textfield-disabled" id="textfield3"
  171. value="Disabled textfield default" readonly>
  172. </div>
  173.  
  174. <div>
  175. <label for="textfield4">Required textfield <span class="required">*</span></label>
  176. <input type="text" name="textfield-required" id="textfield4"
  177. placeholder="Required textfield placeholder" required>
  178. <p>An explanation text after the form field about why a value is required.</p>
  179. </div>
  180.  
  181. <div>
  182. <label for="textfield5">Textfield with data attributes</label>
  183. <input type="text" name="textfield-data" id="textfield5"
  184. value="Textfield default" data-first="Arbitrary data may be added here"
  185. data-second="and some more here">
  186. </div>
  187. </fieldset>
  188.  
  189. <fieldset id="checkboxes">
  190. <legend>Checkbox group</legend>
  191.  
  192. <p>Introductory text with explanation about how you can select multiple items.</p>
  193.  
  194. <div class="inline">
  195. <label for="checkbox1">Uno</label>
  196. <input type="checkbox" name="checkboxset" value="1" id="checkbox1">
  197.  
  198. <label for="checkbox2">Due</label>
  199. <input type="checkbox" name="checkboxset" value="2" id="checkbox2" checked>
  200.  
  201. <label for="checkbox3">Tre</label>
  202. <input type="checkbox" name="checkboxset" value="3" id="checkbox3" checked>
  203. </div>
  204. </fieldset>
  205.  
  206. <fieldset id="radiogroup">
  207. <legend>Radio group</legend>
  208.  
  209. <div class="inline">
  210. <label for="radioinput1">Uno</label>
  211. <input type="radio" name="radiogroup" value="1" id="radioinput1">
  212.  
  213. <label for="radioinput2">Due</label>
  214. <input type="radio" name="radiogroup" value="2" id="radioinput2" checked>
  215.  
  216. <label for="radioinput3">Tre</label>
  217. <input type="radio" name="radiogroup" value="3" id="radioinput3">
  218.  
  219. <p>Informational text about why you need to choose one option.</p>
  220. </div>
  221. </fieldset>
  222.  
  223. <fieldset id="selectsingle">
  224. <legend>Select option</legend>
  225.  
  226. <div class="inline">
  227. <label for="selector1">Make a choice <span class="required">*</span></label>
  228. <select name="selector1" id="selector1">
  229. <option value="first" selected>First</option>
  230. <option value="second">Second</option>
  231. <option value="third">Third option</option>
  232. <option value="fourth">Fourth</option>
  233. </select>
  234. </div>
  235. </fieldset>
  236.  
  237. <fieldset id="selectmulti" class="fieldset-full">
  238. <legend>Select multiple option</legend>
  239.  
  240. <div>
  241. <label for="selector2">Make a choice <span class="required">*</span></label>
  242. <select name="selector2" id="selector2" size="6" multiple>
  243. <optgroup label="Group 1">
  244. <option value="first" selected>First</option>
  245. <option value="second">Second</option>
  246. </optgroup>
  247. <optgroup label="Group 2">
  248. <option value="third" selected>Third option</option>
  249. <option value="fourth">Fourth</option>
  250. </optgroup>
  251. <optgroup label="Group three">
  252. <option value="5">Fifth</option>
  253. <option value="6">Sixth</option>
  254. <option value="7">Seventh</option>
  255. <option value="8">Eighth</option>
  256. <option value="9">Ninth</option>
  257. </optgroup>
  258. </select>
  259.  
  260. <p>Use <kbd>Ctrl</kbd> + <kbd>Click</kbd> to select multiple options.</p>
  261. </div>
  262. </fieldset>
  263.  
  264. <div>
  265. <h3>Markup block</h3>
  266. <p>To separate the different steps or sections in a form, markup is needed.
  267. So this markup block with a <tt><div></tt> tag is inserted here.<br>
  268. The markup block needs HTML elements.</p>
  269. <p>Sometimes all you need is a horizontal line.</p>
  270. </div>
  271.  
  272. <hr>
  273.  
  274. <fieldset id="termsandconditions">
  275. <legend>Terms and conditions</legend>
  276.  
  277. <div class="inline">
  278. <label for="checkbox4">This is a required checkbox <span class="required">*</span></label>
  279. <input type="checkbox" name="checkboxrequired" value="4" id="checkbox4" required>
  280. <p>You may not continue without accepting
  281. <a href="a-link-to-the-terms.html">the terms and conditions</a>.</p>
  282. </div>
  283. </fieldset>
  284.  
  285.  
  286. <fieldset id="datefieldstext">
  287. <legend>Textual date inputs</legend>
  288.  
  289. <div class="half">
  290. <label for="datefield1">Start date</label>
  291. <input type="text" name="datefield1" id="datefield1" class="datepopup">
  292. </div>
  293.  
  294. <div class="half">
  295. <label for="datefield2">End date</label>
  296. <input type="text" name="datefield2" id="datefield2" class="datepopup">
  297. </div>
  298. </fieldset>
  299.  
  300. <fieldset id="personal">
  301. <legend>Personal details</legend>
  302.  
  303. <div class="inline">
  304. <label for="gender">Gender options:</label>
  305.  
  306. <label for="gendermale">Male</label>
  307. <input type="radio" name="gender" value="m" id="gendermale">
  308.  
  309. <label for="genderfemale">Female</label>
  310. <input type="radio" name="gender" value="f" id="genderfemale">
  311.  
  312. <label for="genderother">Other</label>
  313. <input type="radio" name="gender" value="x" id="genderother">
  314. </div>
  315.  
  316. <div>
  317. <label for="firstname">First name</label>
  318. <input type="text" name="firstname" id="firstname">
  319. </div>
  320.  
  321. <div>
  322. <label for="lastname">Last name <span class="required">*</span></label>
  323. <input type="text" name="lastname" id="lastname" required>
  324. </div>
  325.  
  326. <div>
  327. <label for="email">Email address <span class="required">*</span></label>
  328. <input type="email" name="email" id="email" required>
  329. </div>
  330.  
  331. <div>
  332. <label for="dob">Date of birth</label>
  333. <input type="date" name="dob" id="dob">
  334. </div>
  335.  
  336. <div>
  337. <label for="telephone">Telephone</label>
  338. <input type="tel" name="telephone" id="telephone">
  339. </div>
  340. </fieldset>
  341.  
  342. <fieldset id="address">
  343. <legend>Address information</legend>
  344.  
  345. <div>
  346. <label for="company">Organisation / Company</label>
  347. <input type="text" name="company" id="company" placeholder="Two Kings">
  348. </div>
  349.  
  350. <div>
  351. <label for="division">Department</label>
  352. <input type="text" name="division" id="division" placeholder="Standards and accessibility">
  353. </div>
  354.  
  355. <div class="medium">
  356. <label for="street">Street</label>
  357. <input type="text" name="street" id="street" placeholder="Prins Hendrikstraat">
  358. </div>
  359.  
  360. <div class="small">
  361. <label for="number">Number</label>
  362. <input type="text" name="number" id="number" placeholder="91">
  363. </div>
  364.  
  365. <div>
  366. <label for="street2">Additional street</label>
  367. <input type="text" name="street2" id="street2" placeholder="">
  368. </div>
  369.  
  370. <div class="small">
  371. <label for="postalcode">Postal code</label>
  372. <input type="text" name="postalcode" id="postalcode" placeholder="2562 SB" length="8">
  373. </div>
  374.  
  375. <div class="medium">
  376. <label for="city">City</label>
  377. <input type="text" name="city" id="city" placeholder="'S-Gravenhage">
  378. </div>
  379.  
  380. <div>
  381. <label for="state">State</label>
  382. <input type="text" name="state" id="state" placeholder="">
  383. </div>
  384.  
  385. <div>
  386. <label for="country">Country</label>
  387. <input type="text" name="country" id="country" placeholder="NETHERLANDS">
  388. </div>
  389. </fieldset>
  390.  
  391. <fieldset id="commentbox" class="fieldset-full">
  392. <legend>Comments box</legend>
  393.  
  394. <div>
  395. <label for="textarea1">Please leave your comments</label>
  396. <textarea id="textarea1" name="textbox" cols="30" rows="10"
  397. >You might as well tell us what's up.</textarea>
  398. <p>An explanation text after the form field.</p>
  399. </div>
  400. </fieldset>
  401.  
  402. <fieldset class="fieldset-full">
  403. <legend>File upload</legend>
  404.  
  405. <div>
  406. <label for="file1">Upload a file</label>
  407. <input type="file" name="file1" id="file1">
  408. <p>The file must be a document in the format <tt>.doc</tt> or <tt>.pdf</tt>
  409. and it may not exceed <em>1.2 MB</em>.</p>
  410. </div>
  411. </fieldset>
  412.  
  413. <input type="hidden" name="hidden-field" id="hiddenfield1" value="hidden value">
  414.  
  415. <fieldset id="buttons">
  416. <!-- unlabeled fieldset - because sometimes you need that too -->
  417. <p>This fieldset does not have a legend, but it still might have an introduction.</p>
  418. <p>Buttons do not need to be at the end of the form.
  419. But if no submit button is defined one should be added by default to the end of the form.</p>
  420.  
  421. <div class="inline">
  422. <input type="submit" name="submit1" value="Submit 1" id="submit1" class="custombutton">
  423.  
  424. <button type="submit" name="submit2" id="submit2">Submit 2</button>
  425.  
  426. <input type="button" name="button1" value="Button 1" id="button1">
  427.  
  428. <button name="button2" id="button2" class="custombutton">Button 2</button>
  429.  
  430. <p>Every element, including buttons must allow classes for styling.</p>
  431. </div>
  432. </fieldset>
  433.  
  434. <div>
  435. <h2 id="anchortarget">Additional input elements</h2>
  436. <p>The additional input elements are still a bit experimental in the HTML5 standard.
  437. The browser support might be a bit rough.
  438. So these elements are not required for the basic boltforms.
  439. They are a nice-to-have.</p>
  440. </div>
  441.  
  442. <fieldset id="datefields">
  443. <legend>Date inputs</legend>
  444.  
  445. <div class="half">
  446. <label for="datefield3">Start date</label>
  447. <input type="date" name="datefield3" id="datefield3">
  448. </div>
  449.  
  450. <div class="half">
  451. <label for="datefield4">End date</label>
  452. <input type="date" name="datefield4" id="datefield4">
  453. </div>
  454. </fieldset>
  455.  
  456. <fieldset class="fieldset-full">
  457. <legend>Range input</legend>
  458.  
  459. <div>
  460. <label for="rating1">Rate your experience</label>
  461. <input type="range" name="rating1" id="rating1"
  462. list="ratingmarks" min="1" value="3" max="5" step="1">
  463. <datalist id="ratingmarks">
  464. <option value="1" label="1">
  465. <option value="2">
  466. <option value="3">
  467. <option value="4">
  468. <option value="5" label="5">
  469. </datalist>
  470. </div>
  471. </fieldset>
  472.  
  473. <div class="required">
  474. <p><span class="required">*</span> marks required fields.
  475. If there are required fields in a form they must be visually
  476. recognizable and an explanation on the form is required.</p>
  477. </div>
  478.  
  479. </form>
  480.  
  481. <h2>Footer</h2>
  482. <p>A footer might explain some legalities about the rights and privacy
  483. that the visitors give up when they submit their personal information.</p>
  484.  
  485. </body>
  486. </html>
Add Comment
Please, Sign In to add comment