Closed Reefcrazed closed 1 month ago
We’re encountering the same issue. If validation fails and we press the Esc
button to reset the field, the error message persists. As a result, we are unable to edit or select a different column for editing, which makes it feel buggy
After triggering any validation, we cannot press the esc
key to edit a different field. The live demo also has this glitch.
Fixed on 6x: https://github.com/Power-Components/livewire-powergrid/pull/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