• Resolved djguapo

    (@djguapo)


    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 to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @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

    (@djguapo)

    Answer me this, then: how come on this demo here, 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.

    Hi @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

    (@djguapo)

    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

    Hi @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.