SimpleForm e.preventDefault() always
This commit is contained in:
parent
606356246a
commit
7d3089270a
2 changed files with 24 additions and 11 deletions
|
@ -79,18 +79,32 @@ export class SimpleInput extends ImmutablePureComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SimpleForm = ({ children, ...props }) => (
|
export class SimpleForm extends ImmutablePureComponent {
|
||||||
<form className='simple_form' {...props}>{children}</form>
|
|
||||||
);
|
|
||||||
|
|
||||||
SimpleForm.propTypes = {
|
static propTypes = {
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
};
|
};
|
||||||
|
|
||||||
SimpleForm.defaultProps = {
|
static defaultProps = {
|
||||||
acceptCharset: 'UTF-8',
|
acceptCharset: 'UTF-8',
|
||||||
onSubmit: e => e.preventDefault(),
|
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 }) => (
|
export const FieldsGroup = ({ children }) => (
|
||||||
<div className='fields-group'>{children}</div>
|
<div className='fields-group'>{children}</div>
|
||||||
|
|
|
@ -23,7 +23,6 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
onSubmit = e => {
|
onSubmit = e => {
|
||||||
// TODO: Dispatch action
|
// TODO: Dispatch action
|
||||||
e.preventDefault();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Loading…
Reference in a new issue