Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    Your form looks a lot more complex than the one on https://conditional-fields-cf7.bdwm.be/clear_on_hide/ ??

    Could you create a very basic small form to illustrate the problem? This will also help other people with the same problem.

    Thread Starter nicolazeloni

    (@nicolazeloni)

    Here.
    The code is exactly the same as your example, but the fields remain filled out.

    https://www601.regione.toscana.it/tdc/mdu2018/work/

    Please, help me.

    Plugin Author Jules Colle

    (@jules-colle)

    Thanks for this. Really appreciate you setting up a blank installation. This is pretty strange. Can you share the form code and an export of your conditional fields?

    I have the same problem
    Thanks for the help

    • This reply was modified 6 years, 2 months ago by nicolamaioli.
    Thread Starter nicolazeloni

    (@nicolazeloni)

    This is the export of the code

    FORM:

    [checkbox show-group “Show group”]
    [group group-1 clear_on_hide]
    Fill out these fields, then uncheck the checkbox, and check it again. Now everything should be cleared.<br>
    text field: [text text-1]
    dropdown: [select menu-1 “– please select –” “option 1” “option 2”]
    [/group]
    <br>
    [submit “Send”]

    CONDITIONAL FIELDS:

    show [group-1] if [show-group] equals “Show group”

    I have the same problem too.

    I have already solved this, just update the contact form 7

    I have the same problem, and I’m using the latest version of CF7 and this plugin, and WP 4.9.8.

    I had the same issue with WP 4.9.8, just updated to 5.0. Same problem.
    Contact Form 7 isn’t the problem, it is the javascript in conditional fields.
    I added this line to scipts.js after line 215:
    $(':input', $group).get(0).selectedIndex = 0;
    So the condition will look like this:

    if ($group.attr('data-clear_on_hide') !== undefined) {
                            $(':input', $group).get(0).selectedIndex = 0;
                            $(':input', $group)
                                .not(':button, :submit, :reset, :hidden')
                                .val('')
                                .prop('checked', false)
                                .prop('selected', false);
                        }

    Now the select dropdown value will be cleared.
    But make sure you have a “first_as_label” value in your select field.

    I’m having much the same problem, using a drop down to hide groups but when I show them again all the fields remain completed. The above didn’t work for me and indeed that line is at 430 in the scripts.js file I’m looking at. Tried an old version and the latest release of CF7, no joy.

    I can code this separately in jQuery but of course it would be easier were this to work.

    The plugin is great otherwise and saved me lots of timing writing conditional statements – many thanks.

    The script.js file of the conditional fields plugin has only 356 lines.
    You use the latest version 1.4.1?

    My bad, it’s how I had Notepad++ set up, albeit the issue with clear_on_hide still remains. I’m using some code in my global JS file that works fine in the meantime.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘clear_on_hide won’t work’ is closed to new replies.