Hello im using Drupal9 and webforms. Our forms should support international phone numbers, the country selection list is visible but on load is not adding the country code so the users are getting error that the phone is not valid as they need to select the country again in order for the country code to be added on the input.
How i can change this behaviour?
Since you mentioned that the country code gets added when user manually selects the country, I believe you're either using some JS library or a contributed/custom module.
You can try and emulate the same behavior on page load event using
Drupal.behaviorsAlternatively you can try the most widely used contributed module for this use case, which would be International Phone which does this job out of the box.
You can check this in action at https://www.coosto.com/en/demo page