Quantcast
Channel: WordPress.org Forums » [Contact Form 7] Support
Viewing all articles
Browse latest Browse all 49500

itailulu on "[Plugin: Contact Form 7] Form Fields Groups with Custom Post Types"

$
0
0

[this is a followup to my old post: http://wordpress.org/support/topic/create-grouped-form-elements-using-custom-post-types?replies=1
I was able to add form fields groups by registering a new cf7 shortcode, that queries form elements (cf7 tags) from another custom post type. So for example if I need to add name,email and phone fields to a form, I only need to call:
[field-group title name-email-phone]
This allows me to create many forms different forms with same basic fields + extra optional fields.

The forms load correctly and also post correctly but for some reason the validation does not work on forms elements extracted from those groups.
However, fields that are added with the basic cf7 shortcode (e.g. [text* your-title]) are validating correctly.

Does anyone knows why this is happening?

Here's how the new field-group shortcode works:

  1. It queries the database using WP_Query to returns the group of fields (cf7 shortcodes) into variable $form_fields
  2. It then uses wpcf7_do_shortcode($form_fields)` to convert those nested tags into actual form elements</li>
    <li>It then returns the html</li>
    </ol>

    I believe that it has to do with the wpcf7_do_shortcode() happening outside of the form object scope. There must be something i'm missing there...

    Thanks in advance guys!

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


Viewing all articles
Browse latest Browse all 49500

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>