Skip to content
This repository was archived by the owner on Jun 10, 2019. It is now read-only.

Commit 3053554

Browse files
committed
Allow users to submit a form with an enter keydown
1 parent 1477051 commit 3053554

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>Operation Code</title>
4+
<title>Operation Code</title>
55
<meta charset="utf-8">
66
<meta http-equiv="X-UA-Compatible" content="IE=edge">
77
<meta name="viewport" content="width=device-width, initial-scale=1">

src/scenes/home/signup/signup.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ class SignUp extends Component {
6363
validatePasswordConfirm = value =>
6464
value === '' || value === this.state.password;
6565

66-
handleOnClick = (e) => {
66+
handleOnSubmit = (e) => {
6767
e.preventDefault = true;
6868

6969
if (this.isFormValid()) {
70+
console.log('yes');
7071
const { email, zip, password, firstName, lastName, mentor } = this.state;
7172
axios.post(`${config.backendUrl}/users`, {
7273
user: {
@@ -127,7 +128,7 @@ class SignUp extends Component {
127128
/>
128129
{this.state.error && <span>There was an error joining Operation Code™: {this.state.error}</span>}
129130
{this.state.success && <Redirect to="/thanks" />}
130-
<FormButton className={styles.joinButton} text="Join" onClick={this.handleOnClick} theme="red" />
131+
<FormButton className={styles.joinButton} text="Join" onSubmit={this.handleOnSubmit} theme="red" />
131132
</Form>
132133
</Section>
133134
);

src/shared/components/form/formButton/formButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class FormButton extends Component {
1111
[`${this.props.className}`]: this.props.className
1212
});
1313
return (
14-
<button type="button" className={classes} onClick={this.props.onClick}>{this.props.text}</button>
14+
<button type="submit" className={classes} onSubmit={this.props.onClick}>{this.props.text}</button>
1515
);
1616
}
1717
}

0 commit comments

Comments
 (0)