1<!DOCTYPE HTML>
2<html>
3
4<head>
5  <meta charset="UTF-8">
6  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7  <title>Example page for HTML form handling</title>
8</head>
9
10<body>
11
12  <!-- HTML forms can use GET or POST, and the encoding can be application/x-www-form-urlencoded or multipart/form-data.
13       If no method is specified (like <form method="method">), GET should be the default method.
14       If no encoding is specified, application/x-www-form-urlencoded should be the default.
15       Submit buttons may overwrite action, method and enctype by using formaction, formmethod and formenctype.
16
17       References:
18       http://www.w3.org/TR/html401/interact/forms.html
19       http://www.w3schools.com/html/html_forms.asp,
20       http://www.w3schools.com/html/html_form_attributes.asp
21       http://www.w3.org/TR/html401/interact/forms.html#adef-enctype
22  -->
23
24
25  <form action="/handle_form.embedded_c.example.callback">
26    See <a href="http://www.w3schools.com/html/html_form_input_types.asp">HTML form tutorial</a>
27    and <a href="http://www.w3.org/TR/html401/interact/forms.html">HTML spec</a>.<br />
28
29    <fieldset>
30      <legend>Text inputs:</legend>
31      A text: <input type="text" name="textin"><br />
32      A password: <input type="password" name="passwordin"><br />
33    </fieldset>
34
35    <fieldset>
36      <legend>Radio set 1:</legend>
37      <input type="radio" name="radio1" value="val1" checked>val1<br />
38      <input type="radio" name="radio1" value="val2">val2<br />
39      <input type="radio" name="radio1" value="val3">val3<br />
40    </fieldset>
41
42    <fieldset>
43      <legend>Radio set 2:</legend>
44      <input type="radio" name="radio2" value="val1" checked>val1<br />
45      <input type="radio" name="radio2" value="val2">val2<br />
46      <input type="radio" name="radio2" value="val3">val3<br />
47    </fieldset>
48
49    <fieldset>
50      <legend>Checkboxes:</legend>
51      <input type="checkbox" name="check1" value="val1" checked>val1<br />
52      <input type="checkbox" name="check2" value="val2">val2<br />
53      <input type="checkbox" name="check3" value="val3">val3<br />
54    </fieldset>
55
56    <fieldset>
57      <legend>HTML5 inputs:</legend>
58      A number: <input type="number" name="numberin" min="1" max="5"><br />
59      A date: <input type="date" name="datein"><br />
60      A color: <input type="color" name="colorin"><br />
61      A range: <input type="range" name="rangein" min="1" max="5"><br />
62      A month: <input type="month" name="monthin"><br />
63      A week: <input type="week" name="weekin"><br />
64      A time: <input type="time" name="timein"><br />
65      A datetime: <input type="datetime" name="datetimen"><br />
66      A datetime-local: <input type="datetime-local" name="datetimelocalin"><br />
67      An email: <input type="email" name="emailin"><br />
68      A search: <input type="search" name="searchin"><br />
69      A tel: <input type="tel" name="telin"><br />
70      An url: <input type="url" name="urlin"><br />
71    </fieldset>
72
73    <fieldset>
74      <legend>Files:</legend>
75      A file: <input type="file" name="filein"><br />
76      Multiple files: <input type="file" name="filesin" multiple><br>
77    </fieldset>
78
79    <fieldset>
80      <legend>Dropdown:</legend>
81      <select name="selectin">
82        <option value="opt1">opt1</option>
83        <option value="opt2">opt2</option>
84        <option value="opt3">opt3</option>
85      </select>
86    </fieldset>
87
88    <fieldset>
89      <legend>Text area:</legend>
90      <textarea name="message" rows="10" cols="30">Text area default text.</textarea>
91    </fieldset>
92
93    <fieldset>
94    <legend>Submit:</legend>
95      <fieldset>
96        <legend>Submit to Lua script:</legend>
97        This will only work if server side Lua scripting is activated and /handle_form.lua can be found on the server.
98        <br>
99        <input type="submit" value="Submit"  formmethod="POST"  formenctype="multipart/form-data"
100         formaction="/handle_form.lua">
101      </fieldset>
102
103      <fieldset>
104        <legend>Submit to callback:</legend>
105        This will work in the embedded_c example. It will call mg_handle_form_data to parse the request.
106        <br>
107        <input type="submit" value="Submit (form default)">
108        <input type="submit" value="Submit (GET)"                 formmethod="GET">
109        <input type="submit" value="Submit (POST)"                formmethod="POST">
110        <input type="submit" value="Submit (POST, url-encoded)"   formmethod="POST"   formenctype="application/x-www-form-urlencoded">
111        <input type="submit" value="Submit (POST, form-data)"     formmethod="POST"   formenctype="multipart/form-data">
112      </fieldset>
113    </fieldset>
114
115  </form>
116</body>
117
118</html>
119