Provide option to disable default Js validation on Telephone element

Created on 2 July 2024, 2 months ago
Updated 9 July 2024, 2 months ago

Problem/Motivation

When we enable the Enhance support for international phone numbers option in Telephone field, default js validation of phone no. occurs. This static error message is shown The phone number is not valid and it cannot disabled or altered.

Steps to reproduce

  1. Create webform
  2. Add and enable the Enhance support for international phone numbers option in Telephone field
  3. Save webform and check the field. You'll see default js validation on field which cant be removed or changed

Proposed resolution

Add one checkbox in element to disable this fucntionality

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Needs work

Version

6.2

Component

Code

Created by

🇮🇳India Abhijith S

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

Comments & Activities

  • Issue created by @Abhijith S
  • Status changed to Needs review 2 months ago
  • 🇺🇸United States cilefen
  • 🇮🇳India Abhijith S

    Removed unwated code in patch

  • 🇺🇸United States jrockowitz Brooklyn, NY

    What is the reason for disabling the phone number validation? Is it not working as expected?

    I am hesitant to add more features. A simpler approach would be to refactor the JavaScript so that you can override the validate method and even disable it via some custom JavaScript

    The attached patch is a minor refactor which allows you to redefine the below function.

    Drupal.webformTelephoneValidate = function ($telephone) {
      // Skip validation.
      return true;
    }
  • Status changed to Needs work 2 months ago
  • 🇮🇳India Nupur Badola

    I have observed that the after applying the patch, the validation message is not appearing however the field boundary gets red in color but able to submit the form. Can we remove the red color.

  • 🇺🇸United States Luke.Leber Pennsylvania

    I can confirm some general weirdness with the i18n phone feature when used in conjunction with client side_validation.

    It seems like both clientside_validation's and webform's JavaScript is both running against it and that can lead to some confusion when trying to theme things (the error messages can appear in different places in the DOM based on which validator "wins".

Production build 0.71.5 2024