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 }) => (
|
||||
<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…
Reference in a new issue