• Hello,
    I need help to validate a select I created through wpcf7_add_shortcode.

    When selected “notselect” I want to present an error message and do not send the form.

    I’ve tried everything! I thank anyone who can help me.

    The code of my select:

    wpcf7_add_shortcode('eventos_lista', 'createbox', true);
    function createbox(){
    			$lista_produtos = new WP_Query(array('showposts'=>100, 'post_type' => 'eventos'));
    			$output = "<select name='evento' id='evento' class='form-control' onchange='document.getElementById(\"evento\").value=this.value;'><option value='notselect'>Evento</option>";
    			//foreach ( $myposts as $post ) : setup_postdata($post);
    			while ($lista_produtos->have_posts()) : $lista_produtos->the_post();
    
    				$data = rwmb_meta( 'paulo_date' );
    				$ativo = rwmb_meta( 'paulo_radio' );
    				$title = get_the_title();
    				if($ativo == 1) {
    					$output .= "<option value='$title'>$title - $data</option>";
    				}
    
    			endwhile;
    			$output .= "</select>";
    			return $output;
    }

    thanks!

    https://wordpress.org/plugins/contact-form-7/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Validation select custom using wpcf7_add_shortcode’ is closed to new replies.