• Hi Team,

    I have an Enquiry Form for a Company with about 100 Retail Outlets.
    In the form, I have 2 conditionally hidden fields, which only appear when the Region is selected – eg.

    Region:
    – East
    – West

    (East) Select your preferred Outlet for Pickup:
    – East Location 1
    – … (up to 50)

    (West) Select your preferred Outlet for Pickup:
    – West Location 1
    – … (up to 50)

    However there were scenarios where users…
    – Select Region: East
    – Select (East) Prefered Outlet for Pickup: East Location 12
    – Change Region: West
    – Select (West) Prefered Outlet for Pickup: West Location 6

    It results in the database filling up the location with 2 pickups. Which is pretty confusing/appalling when the Admin sees 2 locations showing up, instead of one.

    Is there a way to conditionally clear [(East) Prefered Outlet for Pickup], when [Region: West] is selected?, and vice versa?

    • This topic was modified 8 years, 5 months ago by zacharychan. Reason: Typos
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    nope. not possible for the moment. will consider it for a future update.

    Plugin Author Jules Colle

    (@jules-colle)

    Hey, got some good news for you. The next update will trigger a javascript action that you can hook into.

    So you will be able to write some code like this, to make sure that all data is cleared whenever a group gets hidden:

    /* Clear values of hidden fields */
    jQuery('[data-class="wpcf7cf_group"]').on('wpcf7cf_hide_group', function(e) {
        $group = jQuery(e.target);
        $group.find('input').not(':checkbox, :button, :submit, :reset, :hidden').val('');
        $group.find('option').removeAttr('selected');
        $group.find(':checkbox').removeAttr('checked');
    });

    Wait for any version greater than 1.3.4 in order for this to start working.

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

The topic ‘Clearing Conditionally Hidden Fields’ is closed to new replies.