Title: Conditional &amp; Repeated Fields
Last modified: July 11, 2019

---

# Conditional & Repeated Fields

 *  [danny144](https://wordpress.org/support/users/danny144/)
 * (@danny144)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/conditional-repeated-fields/)
 * Hi,
 * I’m using conditional fields and repeated fields on my form and was wondering
   if your plugin was able to support this?
 * I’m using these two plugins for this:
 * [https://wordpress.org/plugins/ac-cf7-form-field-repeater/](https://wordpress.org/plugins/ac-cf7-form-field-repeater/)
   
   [https://wordpress.org/plugins/cf7-conditional-fields/](https://wordpress.org/plugins/cf7-conditional-fields/)
 * Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Trynda E. Adair](https://wordpress.org/support/users/tryndaadair/)
 * (@tryndaadair)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/conditional-repeated-fields/#post-12152046)
 * Also curious to know.
 *  [Trynda E. Adair](https://wordpress.org/support/users/tryndaadair/)
 * (@tryndaadair)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/conditional-repeated-fields/#post-12213799)
 * Not sure if anyone is still looking for a solution to this, but I put together
   something (albeit not in an overly elegant way of implementing since I unfortunately
   don’t have time set aside for building a custom plugin to handle this and had
   to modify the base plugin).
 * In my use case a new PDF and email was required for each dynamic field added,
   so in the send-pdf.php file I wrapped the PDF generation (wpcf7pdf_send_pdf function)
   and mail (wpcf7pdf_mail_components function, adding an additional wp_mail function
   to send multiple emails) in the following if statement that would check if groups
   were present and iterate through the number of groups to change the variables
   and create multiple PDFs/emails with dynamic content based on the users submission.
 *     ```
       if ( isset( $_POST['_wpcf7_groups_count'] ) ) {
   
       	foreach ( $_POST['_wpcf7_groups_count'] as $group_id => $group_sent_count ) {
   
       		for ( $i = 1; $i <= $group_sent_count; $i++ ) {	
       			$text = preg_replace( '/__1(\s|\])/', "__{$i}]", trim($meta_values['generate_pdf']));
   
       			// Generate PDF Code Goes Here
       		}
       	}
       }
       else
       {
       	// Generate PDF Like Normal
       }
       ```
   
 * In the ‘Personalize your PDF’ area I set the repeatable fields to have the __1
   in the name so the code would be able to find the variables when passed via $
   _POST and change out the number based on the for loops position (although I think
   it will work either way, I just haven’t tested as of yet to confirm).
 * Not sure how this would work with a conditional feild, but this was used leveraging
   the Contact Form 7 – Repeatable Fields ([https://wordpress.org/plugins/cf7-repeatable-fields/](https://wordpress.org/plugins/cf7-repeatable-fields/))
   plugin. Hope this helps someone somehow.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Conditional & Repeated Fields’ is closed to new replies.

 * ![](https://ps.w.org/send-pdf-for-contact-form-7/assets/icon-256x256.png?rev=
   2194770)
 * [Send PDF for Contact Form 7](https://wordpress.org/plugins/send-pdf-for-contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/send-pdf-for-contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/send-pdf-for-contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/send-pdf-for-contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/send-pdf-for-contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/send-pdf-for-contact-form-7/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [Trynda E. Adair](https://wordpress.org/support/users/tryndaadair/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/conditional-repeated-fields/#post-12213799)
 * Status: not resolved