php - How To Validate Phone Numbers in Redux Framework -
i'm trying validate
phone number field available options other text won't work since people may use dashes , parentheses enter number.
i've tried preg_replace
i'm still not seeing error messages when entering incompatible data, e.g. 'x' characters entered text field should accept number value.
besides pop-up appears that:
there problem action. please try again or reload page.
array( 'id' => 'sz-header-contact-phone', 'type' => 'text', 'title' => __( 'phone number', 'redux-framework-demo' ), 'subtitle' => __( 'enter phone number here.', 'redux-framework-demo' ), 'validate' => 'preg_replace', 'preg' => array( 'pattern' => '^\(\d{3}\) \d{3}-\d{4}$', 'replacement' => 'no numbers' ), 'msg' => 'please enter correct phone number', 'placeholder' => 'enter phone number here.' )
thanks help.
regards, hung the.
may use preg_quote() before parsing string.
Comments
Post a Comment