-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Failed validation reverts to last value in input field #1678
Comments
We’re encountering the same issue. If validation fails and we press the |
After triggering any validation, we cannot press the |
Fixed on 6x: #1712 Thank you |
Update: $this->withValidator(function (\Illuminate\Validation\Validator $validator) use ($id, $field) {
if ($validator->errors()->isNotEmpty()) {
$this->dispatch('toggle-'.$field.'-'.$id); // if there is an error, this makes the input enable editing again
}
})->validate(); Demo: https://demo.livewire-powergrid.com/examples/validation |
Have you searched through other issues to see if your problem is already reported or has been fixed?
Yes, I did not find it.
Did you read the documentation?
Yes, I did not find it.
Have you tried to publish the views?
Yes - I didn't work.
Is there an error in the console?
No
PHP Version
8.3.9
PowerGrid
5.10
Laravel
11
Livewire
3.5.6
Alpine JS
3.14.1
Theme
Tailwind 3.x
Describe the bug.
Using EditOnClick for my fields, after any field fails to validate the original value stays in the field, not the value that actually failed. I would think the default value left would be what a user types in.
Example, there is a date field with a value of 09/10/2024 and I input 9/10/2024extradata and that field fails validation. The value sets as 9/10/2024 which is actually valid, but the field stays in an invalid state. If you go back into the field which still shows 9/10/2024 and hit enter it fails validation on the original value. This happens with other validation types, such as validating numbers. This is confusing to users because they are seeing a valid date in the field, other fields cannot be clicked in because of the still failed validation error. I notice the example project for validation acts the same way.
On the example project for validation, if you put in an invalid flavor it will fail validation but vanilla will be the default, if you click back in the input where it says vanilla and hit enter it still fails validation. You literally have to back over the word and retype it for it to pass.
To Reproduce...
Simple project with validation, fail a validation and the default value left in the input will be the original value, not what was typed. This seems to be how the example validation project also works.
Extra information
The text was updated successfully, but these errors were encountered: