Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit b9b4ae4

Browse files
committed
Checking for form value existence before checking form validity in <Form> component. Fixes #139
1 parent 46ed9b4 commit b9b4ae4

File tree

4 files changed

+283
-242
lines changed

4 files changed

+283
-242
lines changed

src/components/form-component.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ class Form extends Component {
8686
validators,
8787
} = this.props;
8888

89-
if (!validators && onSubmit && formValue.valid) {
89+
const formValid = formValue
90+
? formValue.valid
91+
: true;
92+
93+
if (!validators && onSubmit && formValid) {
9094
onSubmit(modelValue);
9195

9296
return modelValue;

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import actionTypes from './action-types';
33

44
import Field, { controlPropsMap, createFieldClass } from './components/field-component';
55
import Form from './components/form-component';
6-
import Errors from './components/errors-component';
6+
// import Errors from './components/errors-component';
77

88
import modeled from './enhancers/modeled-enhancer';
99

@@ -34,7 +34,7 @@ export {
3434
createModelReducer,
3535
Field,
3636
Form,
37-
Errors,
37+
// Errors,
3838
getField,
3939
initialFieldState,
4040
modeled,

0 commit comments

Comments
 (0)