Skip to content

Commit eba9989

Browse files
committed
onSubmit function added
1 parent e5bc6bb commit eba9989

4 files changed

Lines changed: 50 additions & 28 deletions

File tree

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
- [Validate Phone Number](#validate-phone-number)
1717
- [Validate Number](#validate-number-input)
1818
- [Example Reactjs Code](#example-reactjs-code)
19-
- [Licence](#license)
2019
## Installation
2120

2221
You can install the package using npm or yarn:
@@ -44,20 +43,25 @@ Then, wrap your form with <ValidateForm> :
4443

4544
```javascript
4645
<ValidateForm
46+
onSubmit={(event)=> {
47+
console.log("Form submitted",event);
48+
}}
4749
errorElement="#error_show_element" // optional
48-
rules={
49-
{
50+
rules={{
5051
// add the rules here
51-
}
52-
}
52+
}}
5353
>
54+
5455
<form>
5556
<h1 id="error_show_element" > // The error message will appear in this element </h1>
5657
<input type="text" required />
5758
</form>
59+
5860
</ValidateForm>;
5961

6062
```
63+
#### `onSubmit`: This function executes when click on submit button with no validation errors. If you not call this function the form will submit when no validation errors
64+
6165
# Rules
6266
# Validate Required Inputs
6367

src/index.js

Lines changed: 19 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)