Title: Prevent saving empty fields to database
Last modified: June 20, 2023

---

# Prevent saving empty fields to database

 *  [tiagorodriguesweb](https://wordpress.org/support/users/tiagorodriguesweb/)
 * (@tiagorodriguesweb)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/prevent-saving-empty-fields-to-database-2/)
 * (original question posted on CF7 support forum, they recommended to post it here)
 * Hi,
 * I need some help with Contact Form 7. I would like to prevent saving empty fields
   from a contact form to the database. It needs to work to input text fields that
   are empty and for selects with first_as_label.
 * I know first_as_label is supposed to force user to choose one option and it works
   well but I’m using Conditional Fields for Contact Form 7 plugin so some selects
   are nested and not required if the user makes some specific choices. In some 
   cases the user doesn’t need to fill that selects but they are still sent to the
   database.
 * I’m using Contact Form CFDB7 plugin to show Contact Form 7 submissions on the
   dashboard and those not required selects appear too, empty.
 * Any help is greatly appreciated.
 * Update: it can be a code to hide empty fields on the submission dashboard
    -  This topic was modified 2 years, 11 months ago by [tiagorodriguesweb](https://wordpress.org/support/users/tiagorodriguesweb/).

The topic ‘Prevent saving empty fields to database’ is closed to new replies.

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

 * 0 replies
 * 1 participant
 * Last reply from: [tiagorodriguesweb](https://wordpress.org/support/users/tiagorodriguesweb/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/prevent-saving-empty-fields-to-database-2/)
 * Status: not resolved