The library for web and native user interfaces.
Introducing a submit button in the tutorial's comment form
Paul Seiffert committed
May 30, 2013 at 16:54 UTC
cd665be43e97bab3e51eb71090c332da4fb05c53
1 file changed
+5
-2
docs/docs/tutorial.md
+5
-2
@@ -449,13 +449,14 @@ var CommentForm = React.createClass({
449
<form class="commentForm">
450
<input type="text" placeholder="Your name" />
451
<input type="text" placeholder="Say something..." />
452
+ <input type="submit" />
453
</form>
454
);
455
}
456
});
457
```
458
458
-Let's make the form interactive. When the user presses enter, we should clear the form, submit a request to the server, and refresh the list of comments. To start, let's listen for this event and just clear the form.
459
+Let's make the form interactive. When the user submits the form, we should clear it, submit a request to the server, and refresh the list of comments. To start, let's listen for the form's submit event and clear it.
460
461
```javascript{3-12,15,20}
462
// tutorial16.js
@@ -479,6 +480,7 @@ var CommentForm = React.createClass({
480
placeholder="Say something..."
481
ref="text"
482
/>
483
+ <input type="submit" />
484
</form>
485
);
486
}
@@ -541,7 +543,7 @@ var CommentBox = React.createClass({
543
});
544
```
545
544
-Let's call the callback from the `CommentForm` when the user presses enter:
546
+Let's call the callback from the `CommentForm` when the user submits the form:
547
548
```javascript{6}
549
// tutorial18.js
@@ -562,6 +564,7 @@ var CommentForm = React.createClass({
564
placeholder="Say something..."
565
ref="text"
566
/>
567
+ <input type="submit" />
568
</form>
569
);
570
}