Title: Conditional field problem when mandatory or optional
Last modified: February 28, 2023

---

# Conditional field problem when mandatory or optional

 *  Resolved [kingsdavid](https://wordpress.org/support/users/kingsdavid/)
 * (@kingsdavid)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/conditional-field-problem-when-mandatory-or-optional/)
 * Hello,
   In my form, depending on the age of the user, the email field is mandatory
   or optional.So I created a condition to display the mandatory or optional fields
   depending on the age.
 * _[checkbox eleve use\_label\_element exclusive “Mineur ” “Majeur”]_
 * _[group elevemineur]
   Email : [email email][/group]
 * _[group elevemajeur]
   Email* : [email* email][/group]
 * The display works correctly but the code does not work, the email field is considered
   optional regardless of the age chosen (minor or adult).
 * The asterisk (*_) of [email_* email] is not taken into account.
 * Of course, I can create two different names email_minor and email_major but I
   need to have a single item for display in a single column of a table afterwards.
 * Do you have an idea to solve this problem?
   You can see the form page here :[https://www.embba.fr/test2/](https://www.embba.fr/test2/)
 * My WP theme is Bravada
   Thank you
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fconditional-field-problem-when-mandatory-or-optional%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/conditional-field-problem-when-mandatory-or-optional/#post-16512712)
 * Hi, [All field names should be unique](https://conditional-fields-cf7.bdwm.be/docs/troubleshooting/all-field-names-should-be-unique/).
 * If you want to work around this you can use a different name for both email fields(
   for example `email-1` and `email-2`) and in the Mail or To field add this:
 *     ```wp-block-code
       [elevemineur][email-1][/elevemineur][elevemajeur][email-2][/elevemajeur]
       ```
   
 * Alternatively you can upgrade to PRO and simply use the disable_on_hide property
   on the groups the [https://conditional-fields-cf7.bdwm.be/disable_on_hide/](https://conditional-fields-cf7.bdwm.be/disable_on_hide/)
 *  Thread Starter [kingsdavid](https://wordpress.org/support/users/kingsdavid/)
 * (@kingsdavid)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/conditional-field-problem-when-mandatory-or-optional/#post-16514606)
 * Ok but the pro version is horribly expensive for only needing one function. Plus,
   there’s even the option to purchase a lifetime license. 🙁
 *  Plugin Author [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/conditional-field-problem-when-mandatory-or-optional/#post-16514633)
 * So use the first option. it works just as well.

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

The topic ‘Conditional field problem when mandatory or optional’ is closed to new
replies.

 * ![](https://ps.w.org/cf7-conditional-fields/assets/icon-256x256.png?rev=2072595)
 * [Conditional Fields for Contact Form 7](https://wordpress.org/plugins/cf7-conditional-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cf7-conditional-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cf7-conditional-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/cf7-conditional-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cf7-conditional-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cf7-conditional-fields/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/conditional-field-problem-when-mandatory-or-optional/#post-16514633)
 * Status: resolved