Skip to content
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

Move filed validation to validateField #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sedx
Copy link

@sedx sedx commented Mar 29, 2020

Motivation

I have some custom Input. It's accept mask to format value and export value. DOM input element has masked value, but component export already unmasked value.

When I create form, I can't use handleChange, because form will store masked value, so I used bind:value={$form.phone}. To track touched state I add custom blur event handler, where call updateTouched. The last action that I should do to make my form works is validate field value and set errors.

Example of my form: https://codesandbox.io/s/boring-bash-cnv3x

Solution

I moved code that validate field value to new validateField function. Update handleChange to call it. Also add validateField to return of createForm

Return validateField when create from
@rccc
Copy link

rccc commented Jan 19, 2021

Hello,

Is there a way to merge or close this PR ? Is there still some devs here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants