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
@@ -809,6 +810,38 @@ The following props are part of each element in `items`:
809
810
-`onReorderClick: (index, newIndex) => (event) => void`: Returns a function that swaps the items at `index` with `newIndex`.
810
811
-`readonly`: A boolean value stating if the array item is readonly.
811
812
813
+
### Error List template
814
+
815
+
To take control over how the form errors are displayed, you can define an *error list template* for your form. This list is the form global error list that appears at the top of your forms.
816
+
817
+
An error list template is basically a React stateless component being passed errors as props so you can render them as you like:
818
+
819
+
```jsx
820
+
functionErrorListTemplate(props) {
821
+
const {errors} = props;
822
+
return (
823
+
<div>
824
+
{errors.map((error, i) => {
825
+
return (
826
+
<li key={i}>
827
+
{error.stack}
828
+
</li>
829
+
);
830
+
})}
831
+
</div>
832
+
);
833
+
}
834
+
835
+
render((
836
+
<Form schema={schema}
837
+
showErrorList={true}
838
+
ErrorList={ErrorListTemplate} />,
839
+
), document.getElementById("app"));
840
+
```
841
+
842
+
> Note: Your custom `ErrorList` template will only render when `showErrorList` is `true`.
843
+
844
+
812
845
### Custom widgets and fields
813
846
814
847
The API allows to specify your own custom *widget* and *field* components:
@@ -1256,6 +1289,8 @@ render((
1256
1289
), document.getElementById("app"));
1257
1290
```
1258
1291
1292
+
> Note: you can also use your own [ErrorList](#error-list-template)
1293
+
1259
1294
### The case of empty strings
1260
1295
1261
1296
When a text input is empty, the field in form data is set to `undefined`. String fields that use `enum` and a `select` widget work similarly and will have an empty option at the top of the options list that when selected will result in the field being `undefined`.
0 commit comments