SimpleForm e.preventDefault() always

merge-requests/1/head
Alex Gleason 4 years ago
parent 606356246a
commit 7d3089270a
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -79,18 +79,32 @@ export class SimpleInput extends ImmutablePureComponent {
}
export const SimpleForm = ({ children, ...props }) => (
<form className='simple_form' {...props}>{children}</form>
);
export class SimpleForm extends ImmutablePureComponent {
SimpleForm.propTypes = {
children: PropTypes.node,
};
static propTypes = {
children: PropTypes.node,
};
SimpleForm.defaultProps = {
acceptCharset: 'UTF-8',
onSubmit: e => e.preventDefault(),
};
static defaultProps = {
acceptCharset: 'UTF-8',
onSubmit: e => {},
};
onSubmit = e => {
this.props.onSubmit(e);
e.preventDefault();
}
render() {
const { children, onSubmit, ...props } = this.props;
return (
<form className='simple_form' onSubmit={this.onSubmit} {...props}>
{children}
</form>
);
}
}
export const FieldsGroup = ({ children }) => (
<div className='fields-group'>{children}</div>

@ -23,7 +23,6 @@ class RegistrationForm extends ImmutablePureComponent {
onSubmit = e => {
// TODO: Dispatch action
e.preventDefault();
}
render() {

Loading…
Cancel
Save