Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/Collection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ A Collection can be of type: **object** or **array**.

- Default value is *false*.

* **true**: sync validation messages will be showing only when the event onBlur of any collection's field is triggered by the user action at any level of nesting.
The async validation messages will be showing only at form submission.
* **false**: validation messages (sync and async) will be showing only at form submission.
* **true**: sync validation messages will be shown only when the event onBlur of any collection's field is triggered by the user action at any level of nesting.
The async validation messages will be shown only at form submission.
* **false**: validation messages (sync and async) will be shown only at form submission.

```javascript
const [status, validation] = useValidation([anyValidationFunc])
Expand Down Expand Up @@ -156,7 +156,7 @@ const CustomInput = withIndex(({ type, name, value, index, ...restAttr }) => {
</Playground>

<br />
Array Collection of Input fields with indexes handled maunally.
Array Collection of Input fields with indexes handled manually.

```javascript
import { Form, Input, Collection } from 'usetheform'
Expand Down
6 changes: 3 additions & 3 deletions docs/Form.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ Validation at Form level:

<Playground>
{() => {
const graterThan10 = ({ values }) => ((values && (values["A"] + values["B"] > 10)) ? undefined : "A+B must be > 10");
const [status, validationProps] = useValidation([graterThan10]);
const greaterThan10 = ({ values }) => ((values && (values["A"] + values["B"] > 10)) ? undefined : "A+B must be > 10");
const [status, validationProps] = useValidation([greaterThan10]);
return (
<Form touched {...validationProps}>
<Collection object name="values" >
Expand Down Expand Up @@ -279,7 +279,7 @@ export const asyncTestForm = ({ values }) =>
// it could be an API call or any async operation
setTimeout(() => {
if (!values || !values.a || !values.b) {
reject("Emtpy values are not allowed ");
reject("Empty values are not allowed ");
}
if (values.a + values.b >= 5) {
reject("The sum must be less than '5'");
Expand Down
4 changes: 2 additions & 2 deletions docs/FormContext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const onSubmit = (formState) => new Promise((resolve, reject) => { // some async
```

- It will be only invoked if your form passes all validations added at any level (Collections or Fields).
- For each invocation, the value **submitAttempts** will be incremented.
- Each time the function is invoked, the value **submitAttempts** will be incremented.

**`initialState`**: object

Expand Down Expand Up @@ -240,7 +240,7 @@ export const asyncTestForm = ({ values }) =>
// it could be an API call or any async operation
setTimeout(() => {
if (!values || !values.a || !values.b) {
reject("Emtpy values are not allowed ");
reject("Empty values are not allowed ");
}
if (values.a + values.b >= 5) {
reject("The sum must be less than '5'");
Expand Down