• Resolved pawanahluwalia

    (@pawanahluwalia)


    Hi,

    Is there a way to do a conditional hide?

    I would like to hide the submit button if the condition (A AND B AND C) is true in order to block submission of a specific set of entries.

    Thanks for any help.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter pawanahluwalia

    (@pawanahluwalia)

    One way to do this I suppose would be to have three OR conditions:

    show Submit if NOT A
    show Submit if NOT B
    show Submit if NOT C

    Which is the same as:

    Hide Submit if (A AND B AND C) is true

    The only trouble with this is that the Submit button is presented as hidden until the three conditions are NOT TRUE, as opposed to hide it only if the three conditions are TRUE.

    So the option to hide is still preferable.

    Plugin Author Jules Colle

    (@jules-colle)

    yep, that’s how i would do it.

    A group is always hidden by default. so you should only care about the conditions to show the group.

    The only trouble with this is that the Submit button is presented as hidden until the three conditions are NOT TRUE, as opposed to hide it only if the three conditions are TRUE

    That’s not correct imo. Your statement should be:

    Submit button is shown if at least one of the 3 conditions is NOT TRUE
    which is exactly the same as saying
    Submit button is hidden if all 3 conditions are TRUE

    Thread Starter pawanahluwalia

    (@pawanahluwalia)

    Sorry, you are right. I didn’t phrase it correctly. I meant to say that the submit button is hidden until one of the OR statements is NOT TRUE.

    However, I still feel this is not the way it should work. In practical terms, the submit button should be visible by default, not hidden by default. It should be hidden only when the conditions specified are met. At the moment, it is hidden by default, until one of the conditions is NOT TRUE.

    So as a user, you will see no submit button, until you make selections that force it to be shown. While this still works, it would not be my first preference. I was just wondering if there were any workarounds.

    Plugin Author Jules Colle

    (@jules-colle)

    if the condition is met while loading the form, the submit button will be shown immediatly.. so i don’t see the problem. have you actually tried to implement this, and can you share a link to illustrate it’s not working?

    Thread Starter pawanahluwalia

    (@pawanahluwalia)

    Many thanks for your assistance. I’ll make do with the current set up. However, I still think it would be worth considering having a distinct Conditional Hide option, if that is possible.

    Up till now I have been using Caldera Forms. I am trying my hand at using Contact Form 7. So far, so good. But I miss the Conditional Hide option Caldera has.

    Plugin Author Jules Colle

    (@jules-colle)

    Sure thing. If you can present me a case in which it is only possible to achieve some result with a “hide if” clause, i will add it. in fact I already added it in the first versions of the plugin but i got rid of it because I thought it was redundant.

    Thread Starter pawanahluwalia

    (@pawanahluwalia)

    Well my situation is a case in point. I am working around the limitations of the current options.

    I run a tuition centre. The form in question allows parents of my children to reschedule their lessons. So they select three things:

    1. What academic year the child is in. (selection of 2 radio buttons)
    2. The week they wish to reschedule the lesson. (drop down list)
    3. The session in the week they wish to reschedule to. (selection of up to 7 radio buttons)

    Sometimes a particular session becomes full or is cancelled, and I want to indicate that on the form so that parents are forced to select an alternative session in the same week. So I want to display a message saying the selected session is full/cancelled, while simultaneously removing the submit button so that they can’t submit the selection at all.

    As I said, it all works.

    The only thing is I don’t like default selections on my radio buttons which would force the submit button to show. So, initially the submit button is hidden until the conditions force it to show.

    In this case, it would have been nice to have the opposite action of my ‘Session is full’ message – i.e. the submit button only hides when this message is displayed.

    Plugin Author Jules Colle

    (@jules-colle)

    still not getting it. A link would be very helpful.

    Let’s say that when A equals “xyz” or “bla”, or C equals “something”, then the message needs to be shown and the submit button hidden. That would simply work with these conditions, right?

    show [message-group] if A equals "xyz"
    show [message-group] if A equals "bla"
    show [message-group] if C equals "something"
    show [submit-group] if A not equals "xyz"
                    and if A not equals "bla"
                    and if C not equals "something"

    I’m afraid I really need a link to your web page in order to understand what the problem is..

    • This reply was modified 6 years, 6 months ago by Jules Colle.
    Thread Starter pawanahluwalia

    (@pawanahluwalia)

    Please see the link below:

    https://smartlearningtuition.co.uk/formtest

    When you first view this, there is no submit button, because as part of a group the submit button is hidden.

    I have set up a unique condition where if:

    Year Group = Year 5
    Lesson week = Mon 09-Sep-2019
    Year 5 session requested = Sun1 9.45am-12.15pm

    Then a message is displayed and the submit button is hidden. Any other combination should show the submit button and hide the message.

    However, as I said, the form begins with the submit button hidden which is not what I want. I also don’t want to have default selections for the radio buttons.

    Plugin Author Jules Colle

    (@jules-colle)

    You could add an extra condition:

    show [SubmitButton] if Yeargroup equals "" (so just leave the field empty)

    Thread Starter pawanahluwalia

    (@pawanahluwalia)

    Tried your suggestion. Unfortunately, it didn’t work. Still the same as before. But logically I suppose it should work.

    Plugin Author Jules Colle

    (@jules-colle)

    the try: show submit if yeargroup not equals option 1 and if yeargroup not equals option 2

    Thread Starter pawanahluwalia

    (@pawanahluwalia)

    Nope. Still not working.

    You asked to present a case to include a “Conditional Hide” option. Have we reached that stage yet?

    Plugin Author Jules Colle

    (@jules-colle)

    Alright, you convinced me. There is a problem with the radio buttons. equals “” will not work because if there is no radiobutton checked there is nothing to consider. You could solve it with exclusive checkboxes instead, or you could get the Pro version and use the “is empty” operator. https://conditional-fields-cf7.bdwm.be/hide-submit-if-no-radiobuttons-are-selected/

    I’ll add the hide option to my todo list, but I’m not going to give it much priority, because there is the work-around with the exclusive checkboxes.

    Thread Starter pawanahluwalia

    (@pawanahluwalia)

    Doesn’t work with exclusive checkboxes either.

Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Conditional Hide’ is closed to new replies.