• hey, i’m trying to figure out how to do a phone verification on a phone number so that it is valid only when it starts with teh digit “3”
    i’ve managed to put the minlength and maxlength so this is all i need, can anyone help me out pleae? thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter radu25bv

    (@radu25bv)

    function custom_filter_wpcf7_is_tel( $result, $tel ) { 
      $result = preg_match( ^3[0-9]{9,10}$, $tel );
      return $result; 
    }
    
    add_filter( 'wpcf7_is_tel', 'custom_filter_wpcf7_is_tel', 10, 2 );

    will this work as a validation? ty for your time

    Thread Starter radu25bv

    (@radu25bv)

    ^([3])?[0-9]{8,9}$

    ?

    function custom_filter_wpcf7_is_tel( $result, $tel ) {
      $result = preg_match( '/^[3][0-9]{10}+$/', $tel );
      return $result;
    }
    
    add_filter( 'wpcf7_is_tel', 'custom_filter_wpcf7_is_tel', 10, 2 );
    • This reply was modified 3 years, 10 months ago by abdylin.
    • This reply was modified 3 years, 10 months ago by abdylin.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘cf7 tel input first digit’ is closed to new replies.