Livewire Validation - Allow for the current Validation process to set the fields to the pre-validation value(s). #690
Replies: 1 comment
-
Meant to put this under Livewire not flux... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, if the Validation fails the User is taken back to the form, displaying the error messages (if any) that the developer has enabled. It also clears all the fields where wire:model is used.
I propose that Livewire be enhanced to allow for the old values to be brought back and displayed. Yep, I know Laravel's "old" is not available to resolve this and understand the reasoning behind it.
Maybe we could use something like:
$this->validate([
'addresstype' => 'required|gt:0',
'address' => 'required|min:2',])->keepVals();
or allow for the specific fields to retain the original values
OR document a process for us to get the desired result(s).....
The current way, losing the values and forcing the User to re-enter ALL of the values is not user friendly. It is ticking off our Customers & our management and we are almost at the point where we will be forced to remove the use of Livewire unless we come up with a viable solution. And given that we are now instituting Flux, we really do not want to give up on Livewire.
And before somebody beats on me for specifying the field names in the validate clause, there is a good reason behind doing this. Most of the forms all have multiple parts:
Without specifying the fields when executing the validation for the specific sub-area we would execute all of the fields for all of the sub-areas (addresses, emails, etc). Erroneous errors (say that fast) would be displayed. Definitely not User friendly.....
Suggestions or a timeline when this might be addressed by any of the 3 potential solutions I gave above, or a better solution then I gave.....
Beta Was this translation helpful? Give feedback.
All reactions