Telephone validation issues when using states and pages

Created on 17 April 2025, 16 days ago

Steps to reproduce

1. Create a webform with 2 pages
2. On first page, add a checkbox and a telephone element with international support
3. Make the telephone element be visible only when the checkbox is checked.
4. Second page can contain anything
5. View the webform, check the checkbox, fill in a valid phone number
6. Move to the next step, then go back to previous page
7. Notice that the phone element shows a validation error

This happens because when the phone element becomes visible using due to States API, blur event is getting triggered which in turn triggers validation on the phone element.

Since the intl-tel-input utils script is loaded asynchronously (see #3032455), validation is not correctly done and causes the error message to become visible under the phone element.

Proposed resolution

Not sure what the correct solution is, but making the validation only trigger if the phone element is visible seems to work.

🐛 Bug report
Status

Active

Version

6.3

Component

Code

Created by

🇷🇴Romania stefan.butura

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024