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

The number field gets changed when yii form validation fails #71

Open
abilogos opened this issue Jun 2, 2022 · 0 comments
Open

The number field gets changed when yii form validation fails #71

abilogos opened this issue Jun 2, 2022 · 0 comments

Comments

@abilogos
Copy link

abilogos commented Jun 2, 2022

Hi Barols,
thanks for your easy-to-use package.
Actually I have a problem and a solution for it.

My problem is when there is a validation error in the Yii-active-form,

the yii2-phone-input widget would change the phone input with the E::164 mobile format number, because the listener is on the form submit event.

my Expected behavior is: just changing the mobile number when form is ready to get send.

propose

so my suggestion is to use this event : beforeSubmit instead of the submit event, which will be run in the yii active form js.

another problem I have is when I want to remove the listener when I want, I just can't,
because anonymous function binding for listeners, cannot be detached.

so my suggestion for this would be to just make the function as a named function (it can be combined with the field name like : makeIntNumber$id ) so it can be detached if anyone wants to.

regards,

P.S: if you have not the time, I would be happy to fix it myself & make the PR

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