From d6b814d78185bfa25c26f37df6e4aa1ec338b48a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E6=B2=BB=E5=B9=B3?= Date: Tue, 8 Nov 2016 04:05:23 +0800 Subject: [PATCH] Add field types `checkbox` and `checkboxes` --- .../components/forms/user/RegisterForm.js | 28 +++++++++++++ src/common/components/utils/BsForm.js | 41 +++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/src/common/components/forms/user/RegisterForm.js b/src/common/components/forms/user/RegisterForm.js index cc5f6e2..e33f576 100644 --- a/src/common/components/forms/user/RegisterForm.js +++ b/src/common/components/forms/user/RegisterForm.js @@ -27,6 +27,10 @@ const validate = (values) => { errors.password = 'Required'; } + if (!values.isAgreeTerms) { + errors.isAgreeTerms = 'Required'; + } + if (configs.recaptcha && !values.recaptcha) { errors.recaptcha = 'Required'; } @@ -100,6 +104,30 @@ class RegisterForm extends Component { type="password" placeholder="Password" /> + + I agree the terms} + /> Recaptcha is disabled ); /* eslint-enable */ + } else if (type === 'checkbox') { + formControl = ( +
+ +
+ ); + } else if (type === 'checkboxes') { + // ref: + // - + formControl = ( + options.map((option, index) => ( +
+ +
+ )) + ); } else if (type === 'radiobutton') { // ref: formControl = (