-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): #113 add submitFormAutomatically setting
- Loading branch information
Showing
9 changed files
with
202 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
sidebar_position: 14 | ||
--- | ||
|
||
# submitFormAutomatically | ||
|
||
If true, the form will be submitted if the validation is successful. | ||
|
||
### Type | ||
|
||
`boolean` | ||
|
||
### Value by default | ||
|
||
`false` | ||
|
||
### Example | ||
|
||
```js | ||
{ | ||
submitFormAutomatically: true, | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import Form from '../Form/Form'; | ||
import JustValidate, { Rules } from 'just-validate'; | ||
import Input from '@site/src/components/UI/Input'; | ||
|
||
const BeforeSubmitExample = () => { | ||
return ( | ||
<Form | ||
id="submit-automatically_form" | ||
init={(onSuccess) => { | ||
const validator = new JustValidate('#submit-automatically_form', { | ||
submitFormAutomatically: true, | ||
}); | ||
|
||
validator.addField('#submit-automatically_email', [ | ||
{ | ||
rule: 'required' as Rules, | ||
}, | ||
{ | ||
rule: 'email' as Rules, | ||
}, | ||
]); | ||
}} | ||
> | ||
<Input | ||
id="submit-automatically_email" | ||
label="Email" | ||
placeholder="Start typing..." | ||
/> | ||
</Form> | ||
); | ||
}; | ||
|
||
export default BeforeSubmitExample; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters