You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add ```shouldRenderMsgAsHtml``` to components ```validationOption```, in case you need to render html inside your ```messages``` as stated in issue #29
Copy file name to clipboardExpand all lines: docs/v4-doc.md
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,7 @@
67
67
|**asyncMsgObj.message**|**Opt**|**Str**|**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST' (For Textbox or Textarea, better reffer to <ahref="https://codesandbox.io/s/async-checking-via-customfunc-emqgw">Example of async checking username existence </a>**|**""**|
68
68
|**asyncMsgObj.showOnError**|**Opt**|**Bool**|**(Server response) Show AJAX error message or not.**|**true**|
69
69
|**asyncMsgObj.showOnSuccess**|**Opt**|**Bool**|**(Server response) Show AJAX success message or not.**|**false**|
70
+
|**asyncMsgObj.shouldRenderMsgAsHtml**|**Opt**|**Bool**|**Should render your message by dangerouslySetInnerHTML.**|**false**|
// locale: 'en-US', //Optional.[String].Default: "en-US". 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' section, which provides the extensibility for your own locale.
121
122
// msgOnError: "Your custom error message if you provide the validationOption['msgOnError']", //Optional.[String].Default: "" Show your custom error message no matter what(except the message from customFunc) when it has error if it is provied.
122
123
// 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.
124
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
123
125
// customFunc: res => { //Optional.[Func].Default: none. Custom function. Returns true or err message or { error: true, message: 'message', showOnSuccess: true }
124
126
// if (res != 'milk') {
125
127
// return 'Description cannot be other things but milk';
|**asyncMsgObj.message**|**Opt**|**Str**|**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'**|**""**|
175
177
|**asyncMsgObj.showOnError**|**Opt**|**Bool**|**(Server response) Show AJAX error message or not.**|**true**|
176
178
|**asyncMsgObj.showOnSuccess**|**Opt**|**Bool**|**(Server response) Show AJAX success message or not.**|**false**|
179
+
|**asyncMsgObj.shouldRenderMsgAsHtml**|**Opt**|**Bool**|**Should render your message by dangerouslySetInnerHTML.**|**false**|
// locale: 'en-US', //Optional.[String].Default: "en-US". 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' section, which provides the extensibility for your own locale.
215
218
// 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.
216
219
// 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.
220
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
|**asyncMsgObj.message**|**Opt**|**Str**|**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'**|**""**|
263
267
|**asyncMsgObj.showOnError**|**Opt**|**Bool**|**(Server response) Show AJAX error message or not.**|**true**|
264
268
|**asyncMsgObj.showOnSuccess**|**Opt**|**Bool**|**(Server response) Show AJAX success message or not.**|**false**|
269
+
|**asyncMsgObj.shouldRenderMsgAsHtml**|**Opt**|**Bool**|**Should render your message by dangerouslySetInnerHTML.**|**false**|
// locale: 'en-US', //Optional.[String].Default: "en-US". 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 of 'window.REACT_INPUTS_VALIDATION' section, which provides the extensibility for your own locale.
306
311
// 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.
307
312
// 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.
313
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
|**asyncMsgObj.message** |**Opt**|**Str** |**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST'**|**""** |
359
365
|**asyncMsgObj.showOnError** |**Opt**|**Bool** |**(Server response) Show AJAX error message or not.**|**true** |
360
366
|**asyncMsgObj.showOnSuccess** |**Opt**|**Bool** |**(Server response) Show AJAX success message or not.**|**false** |
367
+
|**asyncMsgObj.shouldRenderMsgAsHtml** |**Opt**|**Bool** |**Should render your message by dangerouslySetInnerHTML.**|**false** |
// locale: 'en-US', //Optional.[String].Default: "en-US". 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' section, which provides the extensibility for your own locale.
401
408
// 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.
402
409
// 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.
410
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
|**asyncMsgObj.message** |**Opt**|**Str** |**(Server response) Your AJAX message. For instance, provide it when backend returns 'USERNAME ALREADY EXIST' (For Textbox or Textarea, better reffer to <a href="https://codesandbox.io/s/async-checking-via-customfunc-emqgw">Example of async checking username existence </a>**|**""** |
454
462
|**asyncMsgObj.showOnError** |**Opt**|**Bool** |**(Server response) Show AJAX error message or not.**|**true** |
455
463
|**asyncMsgObj.showOnSuccess** |**Opt**|**Bool** |**(Server response) Show AJAX success message or not.**|**false** |
464
+
|**asyncMsgObj.shouldRenderMsgAsHtml** |**Opt**|**Bool** |**Should render your message by dangerouslySetInnerHTML.**|**false** |
// msgOnError: "Your custom error message if you provide the validationOption['msgOnError']", //Optional.[String].Default: "". Show your custom error message no matter what(except the message from customFunc) when it has error if it is provied.
509
518
// 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.
519
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
510
520
// customFunc: res => { //Optional.[Func].Default: none. Custom function. Returns true or err message or { error: true, message: 'message', showOnSuccess: true }
511
521
// if (res != 'banana') {
512
522
// return 'Description cannot be other things but banana';
### <a name="custom-error-message"></a>Q: Do you support custom locales?
629
+
### <a name="custom-error-message"></a>Q: Do you support custom locales?
620
630
**A**: Yes, and it could be multiple locales. By providing ```window.REACT_INPUTS_VALIDATION['customErrorMessage']```, you can overwrite the error message.
621
631
622
632
<a href="https://codesandbox.io/s/q9vqmk4j84">codesandbox example</a>(located in index.html)
@@ -779,5 +789,5 @@ Then in the component...
779
789
}}
780
790
/>
781
791
```
782
-
792
+
783
793
**For more extensibility or customization please reffer to '[validationOption.customFunc](#customFunc)'**
Copy file name to clipboardExpand all lines: example/index.js
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -928,6 +928,8 @@ class Index extends Component {
928
928
// };
929
929
// }
930
930
// },
931
+
// msgOnError: '<a href="google.com">google</a>',
932
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
931
933
}}
932
934
// asyncMsgObj={this.state.nameAsyncMsgObj}
933
935
// asyncMsgObj={{
@@ -996,6 +998,8 @@ class Index extends Component {
996
998
// locale: 'en-US', // Optional.[String].Default: "en-US". For error message display. Current options are ['zh-CN', 'en-US']; Default is 'en-US'.
997
999
// 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.
998
1000
// 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.
1001
+
// msgOnError: '<a href="google.com">google</a>',
1002
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
@@ -1063,6 +1067,8 @@ class Index extends Component {
1063
1067
// locale: 'en-US', // Optional.[String].Default: "en-US". For error message display. Current options are ['zh-CN', 'en-US']; Default is 'en-US'.
1064
1068
// 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.
1065
1069
// 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.
1070
+
// msgOnError: '<a href="google.com">google</a>',
1071
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
@@ -1130,6 +1136,8 @@ class Index extends Component {
1130
1136
// locale: 'en-US', // Optional.[String].Default: "en-US". For error message display. Current options are ['zh-CN', 'en-US']; Default is 'en-US'.
1131
1137
// 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.
1132
1138
// 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.
1139
+
// msgOnError: '<a href="google.com">google</a>',
1140
+
// shouldRenderMsgAsHtml: true, // Optional.[Bool].Default: false. Should render your message by dangerouslySetInnerHTML.
0 commit comments