8
8
[chapterquote="true"]
9
9
[quote,Mephistopheles,in Goethe's Faust]
10
10
____
11
- I shall this very day, at Doctor's feast, +
12
- My bounden service duly pay thee. +
13
- But one thing!—For insurance’ sake, I pray thee, +
11
+ I shall this very day, at Doctor's feast, +
12
+ My bounden service duly pay thee. +
13
+ But one thing!—For insurance’ sake, I pray thee, +
14
14
Grant me a line or two, at least.
15
15
____
16
16
@@ -22,17 +22,16 @@ designed for a pre-JavaScript Web, assuming that interaction with the
22
22
server always happens by navigating to a new page.
23
23
24
24
But their elements are part of the ((DOM)) like the rest of the page,
25
- and the DOM elements that represent form ((field))s supports a number
25
+ and the DOM elements that represent form ((field))s support a number
26
26
of properties and events that are not present on other elements. These
27
- make it possible to inspect and control them with JavaScript programs.
28
- This makes it possible to add additional functionality to a
29
- traditional form, or to use forms and fields as building blocks in a
30
- JavaScript application.
27
+ make it possible to inspect and control them with JavaScript programs by
28
+ adding additional functionality to a traditional form or by using forms
29
+ and fields as building blocks in a JavaScript application.
31
30
32
31
== Fields ==
33
32
34
33
(((form (HTML tag))))A web form consists of any number of input
35
- ((field))s, grouped in a `<form>` tag. HTML allows a number of
34
+ ((field))s grouped in a `<form>` tag. HTML allows a number of
36
35
different styles of fields, ranging from simple on/off checkboxes to
37
36
drop-down menus and fields for text input. This book won't try to
38
37
comprehensively discuss all of them, but we will start with a rough
@@ -205,8 +204,8 @@ endif::book_target[]
205
204
206
205
(((user experience)))(((asynchronous programming)))When the program is
207
206
busy processing the action caused by some ((button)) or other control,
208
- for example making requests to a server, it can be a good idea to
209
- disable the control until the action finishes, so that when the user
207
+ ( for example, making requests to a server) , it can be a good idea to
208
+ disable the control until the action finishes so that, when the user
210
209
gets impatient and clicks it again, they don't accidentally repeat
211
210
their action.
212
211
@@ -223,7 +222,7 @@ inside of it.
223
222
form field determines the way its value will be identified when the
224
223
form is ((submit))ted. It can also be used as a property name when
225
224
accessing the form's `elements` property, which acts both as an
226
- array-like object (accessible by number) and a ((map)) (accessable by
225
+ array-like object (accessible by number) and a ((map)) (accessible by
227
226
name).
228
227
229
228
[source,text/html]
@@ -278,7 +277,7 @@ calling `preventDefault` on the event object.
278
277
verify that the values the user entered make sense, and immediately
279
278
show an error message instead of submitting the form when they don't.
280
279
Or we can disable the regular way of submitting the form entirely, as
281
- in the example above, and have out program handle the input, possibly
280
+ in the example above, and have our program handle the input, possibly
282
281
using `XMLHttpRequest` to send it over to a server without reloading
283
282
the page.
284
283
@@ -605,7 +604,7 @@ so-called _blob_ object) to the file reader.
605
604
== Storing data client-side ==
606
605
607
606
(((web application)))Simple ((HTML)) pages with a bit of JavaScript
608
- can be a great medium for “((mini application ))”—small helper programs
607
+ can be a great medium for “((mini applications ))”—small helper programs
609
608
that automate everyday things. By connecting a few form ((field))s
610
609
with event handlers you can do anything from converting between
611
610
degrees Celsius and Fahrenheit to computing passwords from a master
@@ -615,7 +614,7 @@ password and a website name.
615
614
remember something between sessions, you can not use JavaScript
616
615
((variable))s, since those are thrown away every time a page is
617
616
closed. You could set up a server, connect it to the Internet, and
618
- have your appplication store something there. We will see how to do
617
+ have your application store something there. We will see how to do
619
618
that in link:20_node.html#node[Chapter 20]. But this adds a lot of
620
619
extra work and complexity. Sometimes it is enough to just keep the
621
620
data in the ((browser)). But how?
@@ -753,7 +752,7 @@ buttons) are used to read or set the field's content.
753
752
754
753
When a form is submitted, its `"submit"` event fires. A JavaScript
755
754
handler can `preventDefault` that event to prevent the submission from
756
- happening. Form fields elements do not have to be wrapped in `<form>`
755
+ happening. Form field elements do not have to be wrapped in `<form>`
757
756
tag.
758
757
759
758
When the user has selected a field from their local file system in a
0 commit comments