• Hello,

    I’m using two CF7 forms on my site and inserted a “acceptance checkbox” validation with a link because of consistency. This works so far.

    To do this I’ve created a shortcode tag “cb” with the desired content:

    function dab_cb_form_tag_handler( $tag ) {
        
        $link_dataprotection = get_privacy_policy_url();
        $html_result = Html::div()
            ->content(
                '<div></div>' .
                '<div>' .
                '[acceptance cb-datenschutz]Ja, ich habe die <a href="' . $link_dataprotection . '">Datenschutzerkl?rung</a> zur Kenntnis genommen.<span class="required">*</span>[/acceptance]' .
                 Html::p()->content('Ich stimme zu, dass meine Angaben und Daten zur Beantwortung meiner Anfrage elektronisch erhoben und gespeichert werden.</p>') .
                 '</div>'
                )
            ->get();
        $formTagsManager = WPCF7_FormTagsManager::get_instance();        
        return $formTagsManager->replace_all( $html_result );
    }
      
    function custom_add_form_tag_clock() {
        wpcf7_add_form_tag( 
            'cb', 
            'dab_cb_form_tag_handler' 
        );
    }
    add_action( 'wpcf7_init', 'custom_add_form_tag_clock' );

    Problem is now, that CF7 doesn’t recognice the required field – here set with the “acceptance” attribute.
    Of course I have activated “acceptance_as_validation: on” in the form settings.

    Would be great someone could help to make this run.

    Juergen

  • The topic ‘CF7 doesn’t recognize “required” field inserted via shorttag’ is closed to new replies.