Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: inputs don't get validated on enter/return key #14

Closed
kaatt opened this issue Jul 25, 2016 · 2 comments · Fixed by #19
Closed

Bug: inputs don't get validated on enter/return key #14

kaatt opened this issue Jul 25, 2016 · 2 comments · Fixed by #19
Assignees
Labels

Comments

@kaatt
Copy link
Contributor

kaatt commented Jul 25, 2016

Bug:

  1. Make a normal form like:
<form onSubmit={formSubmit(this.handleSubmit)}>
    <input type="text" placeholder="username" value={username.value} {...username.events} />
    <input type="password" placeholder="password" value={password.value} {...password.events} />
    <button type="submit">Submit</button>
</form>
  1. User clicks the username input.
  2. Types the username
  3. Presses Tab
  4. password input gets focus
  5. Types any valid password
  6. Presses Enter.
  7. Guess what they see? formStatus.valid is false even when the inputs are correct so handleSubmit alerts Please address the errors in the form
  8. User clicks the button. Works fine because password input loses focus and gets validated.

Possible Fixes:

  1. Give users a way to manually validate the form anytime they want to.
  2. Validate the form before invoking the callback passed to formSubmit.

Probably would fix #7

@ffxsam ffxsam self-assigned this Jul 25, 2016
@ffxsam ffxsam added the bug label Jul 25, 2016
@ffxsam
Copy link
Owner

ffxsam commented Jul 25, 2016

Yep, this is a known issue. I'll get to this soon.

@ghost
Copy link

ghost commented Jul 30, 2016

Also face this bug :(.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants