We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #3800042
Adding Conditional Logic to Custom Fields in Amelia
Closed

Comments

  •  1
    Jannick started the conversation

    Hello Amelia Support Team,

    I am trying to implement conditional logic for custom fields within the Amelia booking form. Specifically, I would like to display or hide certain fields based on a user’s selection in another field (e.g., a dropdown or checkbox).

    For example:

    • If the user selects "Option A," Fields X and Y should appear.
    • If the user selects "Option B," Fields Z should appear instead.

    I am currently using the standard version of Amelia and couldn't find a built-in way to add this kind of dynamic functionality. I reviewed the documentation on custom fields and WP hooks (e.g., amelia_booking_custom_field_data), but I am unsure how to apply it in this context.

    Could you please let me know:

    1. Is it possible to implement conditional logic with the standard version of Amelia?
    2. If not, would the Pro version or additional custom code (e.g., JavaScript or hooks) be required?
    3. Could you provide a step-by-step guide or example code for setting up this logic?

    Thank you for your assistance. I look forward to your guidance.

    Best regards,

  •  1,705
    Uroš replied

    Hello Jannick,

    Thank you for reaching out.

    Conditional logic for custom fields is not natively available in Amelia, regardless of the version you're using. You will need to apply custom code to implement this functionality.

    Here’s what you need to do:

    1. Custom Code Required:
      • Whether you're using the standard or Pro version of Amelia, you will need to implement custom code (JavaScript or hooks) to achieve conditional logic for custom fields.
    2. Example Code: You can use JavaScript to show or hide fields based on user selection. Here's an example:
     
    jQuery(document).ready(function($) { // Initially hide all fields $('#fieldX, #fieldY, #fieldZ').hide(); // Show/hide fields based on dropdown selection $('#dropdownField').change(function() { var selectedOption = $(this).val(); if (selectedOption === 'Option A') { $('#fieldX, #fieldY').show(); $('#fieldZ').hide(); } else if (selectedOption === 'Option B') { $('#fieldZ').show(); $('#fieldX, #fieldY').hide(); } }); });

    This code listens for changes to a dropdown field (#dropdownField) and shows or hides certain fields (#fieldX, #fieldY, #fieldZ) based on the user’s choice.

    Feel free to reach out if you need further assistance with implementing this code or have any additional questions.

    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables