Skip to content

Commit 6de865c

Browse files
author
Edward Xiao
committed
Merge branch 'master' of github.com:edwardfhsiao/react-inputs-validation
2 parents 9c92f4d + 6da4d4f commit 6de865c

File tree

1 file changed

+53
-4
lines changed

1 file changed

+53
-4
lines changed

README.md

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
2626
* <a href="https://codesandbox.io/s/v3wq0llmo3">Online demo form example playground</a>
2727
* <a href="https://codesandbox.io/s/pjom8r78x7">Custom control</a>(when ```check: false```)
2828
* <a href="https://codesandbox.io/s/1r77ozkrk7">Custom function</a>(when providing ```customFunc```)
29+
* <a href="https://codesandbox.io/s/custom-function-further-control-when-providing-customfunc-yjwch">Custom function further control</a>(when providing ```customFunc```)
2930
* <a href="https://codesandbox.io/s/q9vqmk4j84">Custom locales</a>(when providing ```window.REACT_INPUTS_VALIDATION['customErrorMessage']```)
3031
* <a href="https://codesandbox.io/s/13qo2rqxjj">Phone and email validation example</a>(handled with ```customFunc```)
3132

@@ -99,6 +100,10 @@ Tested on IE9+ and Chrome and Safari(10.0.3)
99100
|~~**validationOption.phoneCountry**~~|~~**Opt**~~|~~**Str**~~|~~**Useful when the validationOption['type'] is phone. Check if the phone number matchs en-US phone number format.**~~ <br><br>**No longer support after v1.4.0. For phone or email address validation please reffer to '[Phone and email validation example](#phone-email-validation-example)'**|~~**"en-US"**~~|
100101
|**validationOption.msgOnError** |**Opt**|**Str** |**Show your custom error message no matter what(except the message from customFunc) when it has error if it is provied.**|**""** |
101102
|**validationOption.msgOnSuccess** |**Opt**|**Str** |**Show your custom success message no matter what when it has error if it is provied.**|**""** |
103+
|**asyncMsgObj.error** |**Opt**|**Bool** |**(Server response) Backend validation result.**|**false** |
104+
|**asyncMsgObj.message** |**Opt**|**Str** |**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'**|**""** |
105+
|**asyncMsgObj.showOnError** |**Opt**|**Bool** |**(Server response) Show AJAX error message or not.**|**true** |
106+
|**asyncMsgObj.showOnSuccess** |**Opt**|**Bool** |**(Server response) Show AJAX success message or not.**|**false** |
102107

103108

104109
```js
@@ -153,11 +158,18 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
153158
// return true;
154159
// }
155160
}}
161+
// asyncMsgObj={{
162+
// error: false, // Optional.[Bool].Default: false. (Server response) Backend validation result.
163+
// message: '', // Optional.[String].Default: "". (Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'
164+
// showOnError: true, // Optional.[Bool].Default: true. (Server response) Show AJAX error message or not.
165+
// showOnSuccess: false, // Optional.[Bool].Default: false. (Server response) Show AJAX success message or not.
166+
// }}
156167
/>
157168
```
158169

159170

160171

172+
161173
### <a name="Radiobox"></a>Radiobox
162174

163175
|Props | |Type |Description |Default |
@@ -190,6 +202,10 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
190202
|**validationOption.locale** |**Opt**|**Str** |**For error message display. Current options are ['zh-CN', 'en-US']; Default is 'en-US'. If your are looking for more options, you can take a look at '[window.REACT_INPUTS_VALIDATION](#custom-error-message)' section, which provides the extensibility for your own locale.**|**"en-US"** |
191203
|**validationOption.msgOnError** |**Opt**|**Str** |**Show your custom error message no matter what when it has error if it is provied.**|**""** |
192204
|**validationOption.msgOnSuccess** |**Opt**|**Str** |**Show your custom success message no matter what when it has error if it is provied.**|**""** |
205+
|**asyncMsgObj.error** |**Opt**|**Bool** |**(Server response) Backend validation result.**|**false** |
206+
|**asyncMsgObj.message** |**Opt**|**Str** |**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'**|**""** |
207+
|**asyncMsgObj.showOnError** |**Opt**|**Bool** |**(Server response) Show AJAX error message or not.**|**true** |
208+
|**asyncMsgObj.showOnSuccess** |**Opt**|**Bool** |**(Server response) Show AJAX success message or not.**|**false** |
193209

194210
```js
195211
import { Radiobox } from 'react-inputs-validation';
@@ -232,14 +248,18 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
232248
// msgOnError: "Your custom error message if you provide the validationOption['msgOnError']", //Optional.[String].Default: "". Show your custom error message no matter what when it has error if it is provied.
233249
// msgOnSuccess: "Your custom success message if you provide the validationOption['msgOnSuccess']. Otherwise, it will not show, not even green border." //Optional.[String].Default: "". Show your custom success message no matter what when it has error if it is provied.
234250
}}
251+
// asyncMsgObj={{
252+
// error: false, // Optional.[Bool].Default: false. (Server response) Backend validation result.
253+
// message: '', // Optional.[String].Default: "". (Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'
254+
// showOnError: true, // Optional.[Bool].Default: true. (Server response) Show AJAX error message or not.
255+
// showOnSuccess: false, // Optional.[Bool].Default: false. (Server response) Show AJAX success message or not.
256+
// }}
235257
/>
236258
```
237259

238260

239261

240262

241-
242-
243263
### <a name="Checkbox"></a>Checkbox
244264

245265

@@ -272,6 +292,11 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
272292
|**validationOption.locale** |**Opt**|**Str** |**For error message display. Current options are ['zh-CN', 'en-US']; Default is 'en-US'. If your are looking for more options, you can take a look at '[window.REACT_INPUTS_VALIDATION](#custom-error-message)' section, which provides the extensibility for your own locale.**|**"en-US"** |
273293
|**validationOption.msgOnError** |**Opt**|**Str** |**Show your custom error message no matter what when it has error if it is provied.**|**""** |
274294
|**validationOption.msgOnSuccess** |**Opt**|**Str** |**Show your custom success message no matter what when it has error if it is provied.**|**""** |
295+
|**asyncMsgObj.error** |**Opt**|**Bool** |**(Server response) Backend validation result.**|**false** |
296+
|**asyncMsgObj.message** |**Opt**|**Str** |**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'**|**""** |
297+
|**asyncMsgObj.showOnError** |**Opt**|**Bool** |**(Server response) Show AJAX error message or not.**|**true** |
298+
|**asyncMsgObj.showOnSuccess** |**Opt**|**Bool** |**(Server response) Show AJAX success message or not.**|**false** |
299+
275300
```js
276301
import { Checkbox } from 'react-inputs-validation';
277302
import 'react-inputs-validation/lib/react-inputs-validation.min.css';
@@ -316,6 +341,12 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
316341
// msgOnError: "Your custom error message if you provide the validationOption['msgOnError']", //Optional.[String].Default: "". Show your custom error message no matter what when it has error if it is provied.
317342
// msgOnSuccess: "Your custom success message if you provide the validationOption['msgOnSuccess']. Otherwise, it will not show, not even green border." //Optional.[String].Default: "". Show your custom success message no matter what when it has error if it is provied.
318343
}}
344+
// asyncMsgObj={{
345+
// error: false, // Optional.[Bool].Default: false. (Server response) Backend validation result.
346+
// message: '', // Optional.[String].Default: "". (Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'
347+
// showOnError: true, // Optional.[Bool].Default: true. (Server response) Show AJAX error message or not.
348+
// showOnSuccess: false, // Optional.[Bool].Default: false. (Server response) Show AJAX success message or not.
349+
// }}
319350
/>
320351
```
321352
@@ -359,7 +390,10 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
359390
|**validationOption.locale** |**Opt**|**Str** |**For error message display. Current options are ['zh-CN', 'en-US']; Default is 'en-US'. If your are looking for more options, you can take a look at '[window.REACT_INPUTS_VALIDATION](#custom-error-message)' section, which provides the extensibility for your own locale.**|**"en-US"** |
360391
|**validationOption.msgOnError** |**Opt**|**Str** |**Show your custom error message no matter what when it has error if it is provied.**|**""** |
361392
|**validationOption.msgOnSuccess** |**Opt**|**Str** |**Show your custom success message no matter what when it has error if it is provied.**|**""** |
362-
393+
|**asyncMsgObj.error** |**Opt**|**Bool** |**(Server response) Backend validation result.**|**false** |
394+
|**asyncMsgObj.message** |**Opt**|**Str** |**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'**|**""** |
395+
|**asyncMsgObj.showOnError** |**Opt**|**Bool** |**(Server response) Show AJAX error message or not.**|**true** |
396+
|**asyncMsgObj.showOnSuccess** |**Opt**|**Bool** |**(Server response) Show AJAX success message or not.**|**false** |
363397
364398
```js
365399
import { Select } from 'react-inputs-validation';
@@ -416,13 +450,18 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
416450
// msgOnError: "Your custom error message if you provide the validationOption['msgOnError']", //Optional.[String].Default: "". Show your custom error message no matter what when it has error if it is provied.
417451
// msgOnSuccess: "Your custom success message if you provide the validationOption['msgOnSuccess']. Otherwise, it will not show, not even green border." //Optional.[String].Default: "". Show your custom success message no matter what when it has error if it is provied.
418452
}}
453+
// asyncMsgObj={{
454+
// error: false, // Optional.[Bool].Default: false. (Server response) Backend validation result.
455+
// message: '', // Optional.[String].Default: "". (Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'
456+
// showOnError: true, // Optional.[Bool].Default: true. (Server response) Show AJAX error message or not.
457+
// showOnSuccess: false, // Optional.[Bool].Default: false. (Server response) Show AJAX success message or not.
458+
// }}
419459
/>
420460
```
421461
422462
423463
424464
425-
426465
### <a name="Textarea"></a>Textarea
427466
428467
|Props | |Type |Description |Default |
@@ -465,6 +504,10 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
465504
|**validationOption.locale** |**Opt**|**Str** |**For error message display. Current options are ['zh-CN', 'en-US']; Default is 'en-US'. If your are looking for more options, you can take a look at '[window.REACT_INPUTS_VALIDATION](#custom-error-message)' section, which provides the extensibility for your own locale.**|**"en-US"** |
466505
|**validationOption.msgOnError** |**Opt**|**Str** |**Show your custom error message no matter what(except the message from customFunc) when it has error if it is provied.**|**""** |
467506
|**validationOption.msgOnSuccess** |**Opt**|**Str** |**Show your custom success message no matter what when it has error if it is provied.**|**""** |
507+
|**asyncMsgObj.error** |**Opt**|**Bool** |**(Server response) Backend validation result.**|**false** |
508+
|**asyncMsgObj.message** |**Opt**|**Str** |**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'**|**""** |
509+
|**asyncMsgObj.showOnError** |**Opt**|**Bool** |**(Server response) Show AJAX error message or not.**|**true** |
510+
|**asyncMsgObj.showOnSuccess** |**Opt**|**Bool** |**(Server response) Show AJAX success message or not.**|**false** |
468511
469512
```js
470513
import { Textarea } from 'react-inputs-validation';
@@ -519,6 +562,12 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
519562
// return true;
520563
// }
521564
}}
565+
// asyncMsgObj={{
566+
// error: false, // Optional.[Bool].Default: false. (Server response) Backend validation result.
567+
// message: '', // Optional.[String].Default: "". (Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'
568+
// showOnError: true, // Optional.[Bool].Default: true. (Server response) Show AJAX error message or not.
569+
// showOnSuccess: false, // Optional.[Bool].Default: false. (Server response) Show AJAX success message or not.
570+
// }}
522571
/>
523572
```
524573

0 commit comments

Comments
 (0)