• Im just created a custom form tag using CF7 but the problem is it cant validate

    here is my code

    add_action( ‘wpcf7_init’, ‘custom_add_form_tag_timepicker’ );
    function custom_add_form_tag_timepicker() {
    wpcf7_add_form_tag( array(‘timepicker’,’timepicker*’), ‘wpcf7_timepicker_shortcode_handler’, TRUE );
    }
    function wpcf7_timepicker_shortcode_handler( $tag ) {

    $tag = new WPCF7_FormTag( $tag );

    if ( empty( $tag->name ) ) {
    return ”;
    }

    $class = wpcf7_form_controls_class( $tag->type );

    $atts = array();
    $atts[‘class’] = $tag->get_class_option( $class );
    $atts[‘id’] = $tag->get_id_option();

    $atts[‘name’] = $tag->name;
    $atts = wpcf7_format_atts( $atts );

    $html = ‘<div class=”form-group”>’;
    $html .= ‘<div class=”input-group bootstrap-timepicker”>’;
    $html .= ‘<input %s type=”text” class=”form-control” placeholder=”00:00″/>’;
    $html .= ‘<span class=”input-group-addon”>’;
    $html .= ‘<span class=”glyphicon glyphicon-time”></span>’;
    $html .= ‘</span>’;
    $html .= ‘</div>’;
    $html .= ‘</div>’;

    $html = sprintf( $html , $atts );

    return $html;
    }

    • This topic was modified 7 years, 6 months ago by merckdelmoro.
    • This topic was modified 7 years, 6 months ago by merckdelmoro.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to add Validation to Custom Form Tag cf7’ is closed to new replies.