Title: Conditional Form Fields
Last modified: April 16, 2022

---

# Conditional Form Fields

 *  Resolved [djguapo](https://wordpress.org/support/users/djguapo/)
 * (@djguapo)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/conditional-form-fields-2/)
 * I’m creating a form for my client to add a medical educational program into their
   site using Directorist and dDoctors. In the form, there are fields to specify
   what documents are needed to enroll in the program. Sometimes the program specifies
   the documents, and sometimes it does not.
 * I want to build the Add Listing form so that it first asks if the documents are
   specified or not (using a radio button for Yes/No). If “No” is selected, then
   the form is saved with the field as “Not specified”. If “Yes” is selected, then
   two additional form entries appear: Required Documents and Optional Documents,
   and then these selections are saved in the entry.
 * How can I add conditions to my Add Listing form to accomplish this?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fconditional-form-fields-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Mahdee](https://wordpress.org/support/users/m4hd1bd/)
 * (@m4hd1bd)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/conditional-form-fields-2/#post-15564890)
 * Hi [@djguapo](https://wordpress.org/support/users/djguapo/),
 * As of now, you can only put conditions to custom fields with the Category. What
   I mean is, you can assign a custom field to a particular category and only if
   that category gets selected, that custom field will appear.
    We do not have any
   other conditional logic available currently. But we are evaluating our options
   to make Add Listing Form interactive.
 * Regards,
    Mahdi.
 *  Thread Starter [djguapo](https://wordpress.org/support/users/djguapo/)
 * (@djguapo)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/conditional-form-fields-2/#post-15566272)
 * Answer me this, then: how come on this demo [here](https://demo.directorist.com/theme/ddoctors/add-listing/?directory_type=doctors&plan=569),
   I can see there’s some conditional logic used, for example, in the ‘Doctor Appointment’
   section: if the ‘Check It to Hide Appointment’ option is toggled, then it hides
   the options below. This lets me know two things: 1) That it is indeed available,
   unless this was just hardcoded for demo purposes in which case that’s a case 
   of false advertising since the demo is supposed to show functionality available
   in the theme/plugin if purchased, and 2) That the toggle option is also available,
   despite this not being one of the fields in the Add Listing builder.
 *  [Mahdee](https://wordpress.org/support/users/m4hd1bd/)
 * (@m4hd1bd)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/conditional-form-fields-2/#post-15566528)
 * Hi [@djguapo](https://wordpress.org/support/users/djguapo/), sorry about the 
   confusion.
 * That ‘Check it to Hide Appointment’ comes from the Booking extension and it is
   available with the Booking Field, built-in. It is there to give the listing owners
   a choice to exclude booking from their listing. We’ve quite a few of them actually,
   you’ll see there’s a Hide Business Hours toggle on Business Hours, which comes
   with that Extension and works only with that Field. We also have the Hide Contact
   Listing Owner Form checkbox, which is used to hide the form on the Single Listing
   Page. These are all specifically designed for a specific component. There’s no
   in-general one available that you can use with any field.
 * Hope this clears things up.
 * Regards,
    Mahdi.
 *  Thread Starter [djguapo](https://wordpress.org/support/users/djguapo/)
 * (@djguapo)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/conditional-form-fields-2/#post-15579726)
 * Hello Mahdi,
 * Yes, this does clear this up. My follow-up, then, is: if I enable these extensions
   and add these fields into my form, would I be able to customize the fields by
   editing the code for these extensions, in order to meet the needs of my scenarios?
   If so, what are the PHP files for those extensions/fields as follows?
    - Booking extension
    - Business Hours extension
    - Hide Contact Listing Owner form/extension
 *  [Mahdee](https://wordpress.org/support/users/m4hd1bd/)
 * (@m4hd1bd)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/conditional-form-fields-2/#post-15585452)
 * Hi [@djguapo](https://wordpress.org/support/users/djguapo/),
 * If you do want to modify the code and implement something like this, you can 
   directly do that by Editing the codes of the Directorist fields. All the Directorist
   fields are available under /templates/listing-form/fields. If you want to take
   reference from the other extensions, for booking it is on templates/booking-fields.
   php, and for business hours it is templates/business-hours-fields.php.
 * Regards,
    Mahdi.

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

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

 * ![](https://ps.w.org/directorist/assets/icon-256x256.gif?rev=3185058)
 * [Directorist: AI-Powered Business Directory, Listings & Classified Ads](https://wordpress.org/plugins/directorist/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/directorist/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/directorist/)
 * [Active Topics](https://wordpress.org/support/plugin/directorist/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/directorist/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/directorist/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Mahdee](https://wordpress.org/support/users/m4hd1bd/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/conditional-form-fields-2/#post-15585452)
 * Status: resolved