• Hi, i’m trying to get custom field validation to work.

    I have text field and i would like to restrict the input to 30.20 (minutes.seconds mm.ss)

    I added this to my functions.php file

    add_action('um_custom_field_validation_time','um_custom_field_validation_time', 10, 3);
    function um_custom_field_validation_time( $key, $array, $args ) {
    	global $ultimatemember;
    	$pattern = '/^[0-9][0-9][.][0-9][0-9]?/';
    	$result = preg_match($pattern, $args[$key], $matches);
    	if (!$result) {
    		$ultimatemember->form->add_error($key, __('Insert as 30.03 mm.ss') );
    	}
    }

    I have the custom field validation selected and added ‘time’ to custom action field. I get errors but it dose not validate correctly.

    • This topic was modified 7 years, 2 months ago by jokke72.
  • The topic ‘Custom field validation’ is closed to new replies.