Advertisement
webreach

Elementor form phone and mail validation

Jun 5th, 2019
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. add_action( 'elementor_pro/forms/validation/tel', function( $field, $record, $ajax_handler ) {
  2.     if ( preg_match( '/[0-9]{9,10}/', $field['value'] ) !== 1 ) {
  3.         $ajax_handler->add_error( $field['id'], 'אנא וודא את מספר הטלפון' );
  4.     }
  5. }, 10, 3 );
  6.  
  7. add_action( 'elementor_pro/forms/validation/email', function( $field, $record, $ajax_handler ) {
  8.     if ( preg_match( '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/i', $field['value'] ) !== 1 ) {
  9.         $ajax_handler->add_error( $field['id'], 'אנא וודא את כתובת האימייל' );
  10.     }
  11. }, 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement