From 0497845ad57537255999160b0fa375e3aebd71d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Tue, 29 Jul 2014 16:14:27 +0200 Subject: [PATCH 1/2] Update 09.2-form-input-binding-sugar.md Add better explanation for 2-way data binding to checkboxes using `checkedLink`. As mentionned here: https://github.com/facebook/react/issues/1930 --- docs/09.2-form-input-binding-sugar.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/09.2-form-input-binding-sugar.md b/docs/09.2-form-input-binding-sugar.md index 29317f71d..eafd053b0 100644 --- a/docs/09.2-form-input-binding-sugar.md +++ b/docs/09.2-form-input-binding-sugar.md @@ -66,7 +66,11 @@ var WithLink = React.createClass({ `ReactLink` objects can be passed up and down the tree as props, so it's easy (and explicit) to set up two-way binding between a component deep in the hierarchy and state that lives higher in the hierarchy. -Note that `` supports ReactLink for both `value` and `checked`. +Note that `` supports ReactLink for both `value` and `checked`. For checkboxes, you should use `checkedLink` instead of `valueLink`, as their value is fixed to `on`: +``` + +``` + ## Under the Hood From 2663d7a4e377995c64f938ea6a0ee8d6da8fe712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Wed, 30 Jul 2014 11:17:38 +0200 Subject: [PATCH 2/2] Update 09.2-form-input-binding-sugar.md -> better checkedLink documentation --- docs/09.2-form-input-binding-sugar.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/09.2-form-input-binding-sugar.md b/docs/09.2-form-input-binding-sugar.md index eafd053b0..0e2bc0973 100644 --- a/docs/09.2-form-input-binding-sugar.md +++ b/docs/09.2-form-input-binding-sugar.md @@ -66,9 +66,9 @@ var WithLink = React.createClass({ `ReactLink` objects can be passed up and down the tree as props, so it's easy (and explicit) to set up two-way binding between a component deep in the hierarchy and state that lives higher in the hierarchy. -Note that `` supports ReactLink for both `value` and `checked`. For checkboxes, you should use `checkedLink` instead of `valueLink`, as their value is fixed to `on`: +Note that checkboxes have a special behavior regarding their `value` attribute, which is the value that will be sent on form submit if the checkbox is checked (defaults to `on`). The `value` attribute is not updated when the checkbox is checked or unchecked. For checkboxes, you should use `checkedLink` instead of `valueLink`: ``` - + ```