colinaut / alpinejs-plugin-simple-validate

Simple Alpine form validation plugin
97 stars 4 forks source link

type Password not working on first enter hit #21

Closed kevinmu17 closed 11 months ago

kevinmu17 commented 11 months ago

When you have a simple login form and you enter your credentials, it fails and console.logs 'password required' When you hit enter again it submits the form. If you remove the required attribute from the password field it works.

<form x-validate @submit="$validate.submit">
    <input name="name" type="email" required>
    <input type="password" name="password" required>
    <input type="submit" value="Login">
</form>
colinaut commented 11 months ago

Looking into this. It's definitely an odd one, though I admit I haven't fully testing password fields with the validator. I'll need to dig in to see what is happening.

colinaut commented 11 months ago

Ok found the bug! It was an issue with submit validation function that if a user hit return on the last field it didn't blur so didn't validate. It now double checks revalidating the fields on submit.

New version 1.7.23 fixes the issue