Closed (fixed)
Project:
Telephone International Widget
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Jul 2019 at 03:11 UTC
Updated:
2 Jun 2025 at 14:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
skymen commentedI fixed this issue for me. Also I have implemented function witch allow entering in the input field only symbols from phone number (digits, +, -, ()). Format of JS changed to ECMAScript 6.
Comment #3
skymen commentedComment #4
hotwebmatter commentedCode looks good. RTBC+1
Comment #5
johnpicozziTested it and this works way better! RTBC +1
Comment #6
jcmartinezThe patch #2 didn't work for me when editing a page that has two phone numbers.
Probably works when creating a page, but it didn't work for me when editing.
Comment #7
jcmartinezComment #8
dasginganinjaI can confirm what jcmartinez says in #6. When I have two separate fields, phone and fax, on the same edit page they seem to conflict and they switch back and forth with losing the country code / which field passes validation.
Comment #9
jcmartinezI'm guessing that these two issues may be related.
Comment #10
kerasai commentedHi folks,
I've added to the patch from #2 to address this multiple values issue as well as the issue reported on #3143446: Flag not selected on node editing form forces user to re-select which deals with initializing the input when the value is being edited.
There is some sketchy stuff in the JS for this, which I've tried to clean up just enough to make things work and a bit more standard for Drupal use. The crux of the functionality remains as-is. Long term, I think it may make more sense to provide a
@Elementplugin for providing the input as a first-class form element.Change Summary
jQueryin attach behavior, targeting thecontext(newly-added page content) onlyintlTelInput, which was breaking reordering of field valuesintlTelInputwhen JS initializesTesting Instructions
telephone_validation)Comment #11
kerasai commentedAnother adjustment, this time to the libraries handling.
I've got some fairly complicated forms, lots entities embedded within entities (IEF) and a lot of AJAX updates, and I was running into an issue with the ITI library initializing. Tracked it down to the
utils.jshelper library not being loaded.This change includes
utils.jsas a part of the library definition and removes it from the ITI initialization option. I've also created a second library definition to be used for the module's JS that depends on the ITI library.Comment #12
kerasai commentedFound another issue caused by copying the widget's
$elementform array, causing a duplicate "value" for the field.Attached is a patch to correct this.
Comment #13
jollysolutionsI tried the patch in #12 and was getting the telephone fields duplicated.
Comment #14
nginex commentedComment #16
nginex commentedDid not check previous patches, just used core/once to handle the issue with multiple fields, tested on real project, works like a charm
Comment #17
ahmad khader commentedI tested the patch mentioned in #12, and it was successful for me. However, I believe we should format the hiddenInput to INTERNATIONAL rather than E164, as the placeholder suggests the presence of spaces.
It would be nice if in the future we added a format option to display the field
Comment #18
ahmad khader commentedReset of code of #17
Comment #19
jcandan commentedComment #20
jcandan commentedComment #21
jcandan commentedComment #22
jcandan commentedI think I see what happened. It seems Ahmad's #17 patch mistakenly missed somethings, #18 is a re-roll of #12 with his desired change to INTERNATIONAL format rather than E164.
Comment #23
jcandan commentedThis is a big undertaking. While I do believe it is ideal to tackle issues distinctly, the frequency of updates to this module has made it such that a big change affecting multiple bugs is inevitable. I will review this further. I plan to add tests as described in #10. Thanks, everyone.
Comment #25
avpadernoComment #26
jcandan commentedGiven this is loaded when the widget is used, let's adopt the above implementation in lieu of the changes made from #11.
Comment #27
jcandan commentedNever mind. That
intlTelInputWithUtils.jsdoesn't even come with the package. Must be outdated docs.Comment #28
avpadernoThe issue tag for Commerce is Commerce 2.x. Since somebody used another tag, that has been renamed Commerce 2.x (duplicate) to make clear it should not be used.
Comment #29
jcandan commentedGot a test added and refactored the work from the above patches and MR !8. Good job and thanks , everyone.
Comment #30
jcandan commentedComment #31
johnpicozziGave folks from above Credit for this issue. @jcandan any reason not to give folks credit?
Comment #32
johnpicozziSorry my above comment had a typo and sounded really rude. It was supposed to say "gave" not "give" (now fixed). Turns out I can't give Credit. @jcandan can we give folks credit for working on this issue?
Comment #33
jcandan commentedAbsolutely! Thanks for calling that out, @johnpicozzi. I'll take a moment to look through the other tickets which may have influenced the total sum of changes captured here. Thanks everyone for your patches, MRs, and review.
Comment #34
johnpicozziThank you!