From f0faede640d75d559d96bff4415c89ff688dc286 Mon Sep 17 00:00:00 2001 From: Christian Alfoni Date: Wed, 21 Jan 2015 15:21:21 +0100 Subject: [PATCH] Mapping documentation --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index fa8541e..8f0ddea 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,27 @@ Supports **json** (default) and **urlencoded** (x-www-form-urlencoded). **Note!** Response has to be **json**. +#### mapping +```javascript +var MyForm = React.createClass({ + mapInputs: function (inputs) { + return { + 'field1': inputs.foo, + 'field2': inputs.bar + }; + }, + render: function () { + return ( + + + + + ); + } +}) +``` +Use mapping to change the data structure of your input elements. This structure is passed to the onSubmit handler and/or to the server on submitting, depending on how you submit the form. + #### onSuccess(serverResponse) ```html