Canvas' International phone input Default value does not reset in popup

Hello everyone,

After spending a considerable amount of time troubleshooting, I wanted to share a workaround for a persistent issue with Airdev’s International Phone Input plugin.

As some users have noted in the plugin reviews, while the Airdev’s International Phone Input plugin is fantastic (I tried many alternatives with little satisfaction), it has a significant flaw: when used multiple times on the same page (such as editing multiple Things’ phone numbers in a pop-up), the default value only works correctly for the first Thing.

The Problem:

When you have several Things on the page (repeating group or not), and you edit one Thing, you load the Thing’s data into a pop-up and display the pop-up. In the pop-up, you use the International Phone Input plugin, setting its default value to the Thing’s phone number.

  • The first time you open the pop-up, everything works fine: Thing A’s phone number loads correctly in the plugin, allowing you to modify or keep it.
  • If you close the pop-up without saving and then open it again for a different Thing (Thing B), you encounter a problem: the phone number in the plugin still shows Thing A’s phone number instead of Thing B’s.

The Solution:

To prevent this issue, you need to add two extra steps to the workflow when editing a Thing’s phone number:

  1. Load the Thing’s data into the pop-up.
  2. Extra Step 1: Set a dummy state with the value of the Airdev International Phone Input plugin (I named this state “honeyPot” to indicate it is just a temporary holder).
  3. Extra Step 2: Use the “Reset relevant inputs” action.
  4. Show the pop-up.

Step-by-Step Workflow:

  1. Load the Thing’s data: Ensure the plugin has the new data available to reset its default value when it will need to do so.
  2. Set a dummy state: Force Bubble to “use” the plugin value (even if not previously used because the user did not update anything).
  3. Reset relevant inputs: This action refreshes Airdev’s International Phone Input plugin to its default value, now reflecting the new Thing’s phone number (because of step #1).
  4. Show the pop-up: This initializes Airdev’s International Phone Input plugin with the new Thing’s phone number.

Notes:

  • This solution is applicable in reusable elements and any scenario where the Airdev International Phone Input plugin is used multiple times on the same page.
  • The order of the steps is crucial for the solution to work correctly.

I hope this helps! :slight_smile:

4 Likes

There is currently a bug with the reset function in bubble plugins that causes this plugin to throw an error and likely is leading to the reset issues you mentioned.

Also, FYI, Airdev is using a version of the intl-tel-input js plugin that is about 1.5-2 years old. This may not be an issue for you, but it also means that that they are not using the latest versions and changes that any countries have implemented in their phone formats via libphonenumber. These changes happen often.

I would reach out to Airdev and see if they can update their reset function. Also, I happend to noticed that the Zeroqode recently updated their Phone Number Input + Formatting for the very same reason. We decided to roll our own version of the intl-tel-input js library just because we kept running into issues such as these.

2 Likes

Hi @andrew

Thank you for your input. I’m not using autobinding, so I don’t think the bug you’re referring to is applicable to my situation.

Regarding the intl-tel-input JS plugin, I appreciate the notification! I’ll keep an eye on this. Currently, I’m satisfied with the delay since I’m targeting a smaller set of countries for an MVP.

I tried the Zeroqode plugin but wasn’t happy with the configuration or the look and feel, so I reverted to using Airdev.

If you think there’s a possibility that I could benefit from your version, please let me know.

Thanks,
Johann

Hey guys
Any chance you were able to show the dropdown within a popup? On my end only the input is visible but the dropdown content doesn’t show.

Looks like a z-index issue?

Victor

Hi @vnihoul77
I’ve been able to use the plugin in a popup.
In my case, the content of the popup is generated in a reusable element but that should not impact the dropdown.
Good luck :slight_smile:

Well the laptops been airborne.

Not sure I am following your steps here, however I did find my own solution after a way too many attempts. I expect it will bite me later, but I cant give it anymore time… and is here for my sad reference later when i need to troubleshoot.

I have a state in the popup called “s_userPhone”
the InternationalPhoneInput value default value is set to this state.

I have TWO separate “Do when This CustomDefinition is visible” - one set the state to be NULL, the other sets the state to be the value that i need, in this case the users, user profile phone number.

This works, i dont really know why… sadly… but if anyone else wants a fix for a laptop throwing issue… try it.

I do suspect the microsecond delay does a reset on the values as you mentioned and gives the correct data… just feels like its gonna break.

I managed to get around this problem just by using “Reset a group/popup” on the button that opens the popup.

Obs: o “Reset a group/popup” tem que estar depois do “display data”.

Hey everyone!

Thanks for pointing out those issues, we’ve since been working on improving the plugin and just released a new version which should fix all of them :smiley:

We’ve also taken some time to update the library used behind the scenes, so this new version is up-to-date with their latest release, which also includes some visual improvements! As @andrew mentioned, keeping it up to date is important to make sure the phone validation logic stays correct, but as we’re using their “practical validation” strategy by default, the plugin should be sufficiently precise and future-proof for most use-cases.

Feel free to reach out to plugins@airdev.co in case you have any other issues with our plugins, we’ll be happy to help!

Best,
Airdev plugin team