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

InputPhone: always submit complete E.164 number #1445

Merged
merged 1 commit into from
Feb 18, 2024

Conversation

NicolaIsotta
Copy link
Contributor

fixes #1393

marking it as draft as I still have to test CSP

@jepsar
Copy link
Member

jepsar commented Feb 14, 2024

What exactly is the full number? And what is the difference with the number that is posted currently?

@NicolaIsotta
Copy link
Contributor Author

NicolaIsotta commented Feb 14, 2024

Check https://github.com/jackocnr/intl-tel-input#recommended-usage

You can always get the full international number (including country code) using getNumber, then you only have to store that one string in your database (you don't have to store the country separately), and then the next time you initialise the plugin with that number it will automatically set the country and format it according to the options you specify (e.g. when using nationalMode it will automatically display the number in national format, removing the international dial code).

The currently submitted value does not include the international dial code

@jepsar
Copy link
Member

jepsar commented Feb 14, 2024

We just use nationalMode="false", but I guess you want to be using true here?

@melloware melloware added this to the 14.0.0 milestone Feb 14, 2024
@NicolaIsotta
Copy link
Contributor Author

We just use nationalMode="false", but I guess you want to be using true here?

Yeah, to keep the international prefix in the dropdown, but to have it in the submitted value.

I'm not sure 'bout the attribute name. Maybe fullValue is not clear enough? I'm thinking about fullValueSubmit/fullNumberSubmit or submitFullValue/submitFullNumber

@melloware I targeted 13.X as it's not a breaking change, let me know if have to change to 14.X only

@melloware
Copy link
Member

13.x is fine. i am not sure about fullValue either maybe "rawValue" or "completeValue" ?

@melloware melloware modified the milestones: 14.0.0, 13.0.6 Feb 14, 2024
@jepsar
Copy link
Member

jepsar commented Feb 15, 2024

I'm not sure whether to make this an option. Also, I think I just might want to make E.164 the default and allow users to convert from there (if needed). If currently incomplete numbers are returned in certain scenarios, that's a bug IMO.

@NicolaIsotta
Copy link
Contributor Author

  • Now the submitted value is always E.164-formatted
  • The utils.js is required by the getNumber() function
  • tested with CSP

@NicolaIsotta NicolaIsotta changed the title InputPhone: add attribute to enable full number submit InputPhone: always submit complete E.164 number Feb 15, 2024
@jepsar jepsar linked an issue Feb 15, 2024 that may be closed by this pull request
@melloware melloware added the enhancement Improve an existing component label Feb 15, 2024
@melloware
Copy link
Member

Is this PR ready?

@jepsar
Copy link
Member

jepsar commented Feb 18, 2024

I would like to test this. Maybe I can do it today.

@melloware melloware merged commit f51c9a7 into primefaces-extensions:13.0.x Feb 18, 2024
2 checks passed
@jepsar jepsar modified the milestones: 13.0.6, 14.0.0 Feb 18, 2024
melloware added a commit that referenced this pull request Feb 18, 2024
@jepsar
Copy link
Member

jepsar commented Feb 18, 2024

@NicolaIsotta thanks for your fix!

@NicolaIsotta NicolaIsotta deleted the issue1393 branch February 18, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve an existing component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InputPhone: always submit complete E.164 number
3 participants