• Resolved loganless

    (@loganless)


    I’m using wpcf7_add_form_tag for add a custom tag to my form with conditional tags. The custom tags code is this:

    
    add_action( 'wpcf7_init', 'cf7_add_quote_fiels' );
     
    function cf7_add_quote_fiels(){
    	wpcf7_add_form_tag( 'quote_fields', 'cf7_add_quote_fiels_handler', array( 'name-attr' => true ) );
    }
    
    add_shortcode( 'quote_fields', 'cf7_add_quote_fiels_handler' );
    
    function cf7_add_quote_fiels_handler( $tag ){
    
    	$code = '';
    	$tag = new WPCF7_FormTag( $tag );
    	$name = $tag->name;
    
    	$code .='<div class="wpcf7 quote-form-wrapper">';
    	$code .='test';
    	$code .='</div>';
    	
    	return $code;
    }
    

    When i use it with Conditional Fields plugin, the conditions doesn’t works. This is the javascript error:

    SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

    Connected to /wp-content/plugins/cf7-conditional-fields/js/scripts.js (line 18)

    Any idea?

    • This topic was modified 8 years, 9 months ago by loganless.
    • This topic was modified 8 years, 9 months ago by loganless.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Custom form tag & conditional fields – JSON.parse: unexpected character’ is closed to new replies.