Closed AndyOGo closed 5 years ago
hmh maybe a generic value normalization hook would be a good idea 🤔
I don't think this is a very common use case. Plus, it would be a pain to implement with some of the validators.
Maybe there is another way to do that. This is what I'm doing in one of my project:
normalize
function on your fieldsreduxForm
touchOnBlur: false
optionThanks for your quick answer @gtournie
Yeah, we tried normalize
already. We just didn't like that unprofessional users could get the idea that their input isn't recognized if they press space either at the beginning or end.
So we wanted a normalization upon onBlur
, but this leads to false-negatives of our validations.
So I just wrapped all validations for <Field />
within a dedicated validation funcion, which first normalizes the value
and then delegates to the validator.
So it's very simple to archive what we want from the outside, from my point of view this ticket can be closed.
Similar to
allowBlank
I would like to allow white space around the user's input. UpononBlur
it will be normalised and trimmed.I use this
Field
replacement for on-blur-normalization: https://github.com/jcoreio/redux-form-normalize-on-blurUse cases are: