Support » Plugin: Contact Form 7 - Conditional Fields » checkbox toggle not working

  • Resolved IT Hertz

    (@it-hertz)


    I’m trying to toggle show/hide one group while showing/hiding a second group when the user checks and unchecks a terms and conditions checkbox. Unfortunately, the plugin doesn’t work at all with [acceptance] tags.

    I want it to hide the terms and show the submit button when the user checks the box — ergo, when they agree to the terms, they are then allowed to submit the form (upload), if they unagree, the terms show again and the submit button disappears.

    The plugin toggles the submit button group properly, but only when that’s the only element I have set conditions for. It doesn’t work at all with the terms group and the submit button group is hidden and won’t toggle when I add conditions for the terms group.

    I’ve tried everything I could think of, including trying to fool the plugin into thinking plaintext was a legit CF7 tag by using [text text-1], and <label> to see if that mattered.

    Also, the conditions for the submit button group get corrupted and won’t work sometimes when I try to add conditions for the terms group, and I have to remove all conditions and even at times delete the entire form and paste the original (same) form block back into CF7’s form tab.

    tldr;
    It doesn’t work with more than one group, at least when a checkbox is the trigger. And it would be nice if it would work with plaintext — it doesn’t, even if the text is the only group.

    • This topic was modified 3 years ago by IT Hertz.
Viewing 5 replies - 1 through 5 (of 5 total)
  • IT Hertz

    (@it-hertz)

    Well, for some reason it is working with plain text now, but the problem remains that setting more than ONE condition breaks the plugin and none of the conditions work.

    IT Hertz

    (@it-hertz)

    To clarify, two opposing toggle states can’t be set as conditions.
    If I set both conditions to SHOW upon checking the checkbox, the toggle works, it shows/hides both groups with check/uncheck.
    However, if I set the submit button group to show and the terms group to hide upon checking the checkbox, it either breaks and both groups stay hidden (sometimes) or only the submit button toggle works.
    I also tried not equals on the terms group to try to show terms when the checkbox is unchecked, but terms is never shown in this case.

    Plugin Author Jules Colle

    (@jules-colle)

    Could you please paste the form code and conditions that aren’t working. There’s less chance I misunderstand your question that way and it would be a great help if I can just paste the code and test it. Thanks

    IT Hertz

    (@it-hertz)

    Hello, they are as follows:

    Form:

    [group terms]<b><span style="color:#000; background-color:#ffcc00;">Uploading is disabled until you agree to our terms:</span></b>
    Terms & conditions go here.[/group]
    [checkbox checkbox-1 "I agree to the above terms"]
    [group submit]<b><span style="font-family:Verdana; color:#fff; background-color:#006000;">Thank you. &nbsp;You may now</span> </b> [submit class:search-button "Upload"][/group]

    Exported rules:

    if [checkbox-1] equals "I agree to the above terms" then show [submit]
    if [checkbox-1] equals "I agree to the above terms" then hide [terms]

    I also tried:

    if [checkbox-1] equals "I agree to the above terms" then show [submit]
    if [checkbox-1] not equals "I agree to the above terms" then show [terms]

    and:

    if [checkbox-1] equals "I agree to the above terms" then show [submit]
    if [checkbox-1] not equals "I agree to the above terms" then show [terms]
    if [checkbox-1] equals "I agree to the above terms" then hide [terms]

    For the terms, I also tried (not all at once):

    if [checkbox-1] equals "" then show [terms] (i.e., I left the value field empty)
    if [checkbox-1] equals null then show [terms]
    if [checkbox-1] equals $null then show [terms]

    The plugin evidently doesn’t parse null strings/parameters. Looking at your php, perhaps adding an is_null in the if (is_array($conditions)) { block would parse and toggle on such nulls? Or maybe you could check state via jQuery?

    • This reply was modified 3 years ago by IT Hertz.
    • This reply was modified 3 years ago by IT Hertz.
    Plugin Author Jules Colle

    (@jules-colle)

    sorry for the late reply.

    I guess if [checkbox-1] not equals "I agree to the above terms" then show [terms] would do the trick.

    I’m cleaning out this forum a bit. If you still have this problem, please create a new support thread and link to this one.

    • This reply was modified 2 years, 9 months ago by Jules Colle.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘checkbox toggle not working’ is closed to new replies.