When using "Contains" in "Show/Hide a Field" Condtion after first found match the rest is not checked

  • Profile Image
    Asked on March 21, 2016 at 07:42 AM

    I have a text field which contains one or more of the strings "walk" "bbq" and "quiz" (not including the quotes). I have conditions "if event contains walk" "if event contains bbq" and "if event contains quiz".

    If event contains more than one of the three words, only the first of them triggers its condition. So only one of the associated sections of the form gets displayed.

    I have tried seperating the words by spaces or commas.

    Why does it not detects the second or third words?

  • Profile Image
    Answered on March 21, 2016 at 09:08 AM

    Hi there,

    I think the condition detects the first matched text, then ignores the others. So, you can combine all of the three words in one "Show/Hide a Field" condition and  set it to "If "Any" of the "If" rules are matched".

    Please, see the example setup from the below:


    Please, try this one and let us know the results.


  • Profile Image
    Answered on March 21, 2016 at 04:55 PM

    Sorry, that does not solve my problem. What I want to do is show different sections of the form depdending on which of the words are present. So if one of the words is present I want its section, if two of them are present I want both their sections, and if all three are present I want all three sections.

    Why should it ignore remaining tests once a match has been found?

    I guess that I need tohave three fields, e.g. walkevent, quizevent, bbqevent, and set the ones I want to true and the othersto false, andthentetvthem instead of the existing event field.

  • Profile Image
    Answered on March 21, 2016 at 05:26 PM

    To do that, you would need to create multiple conditions.

    One that checks for quiz only. The other that checks for bbq only and the third one that checks for walk only.

    Then based on them, you could show / hide the relevant segments.

    If your sections are grouped then I would suggest hiding them with form collapse fields and using them as such on your form.

    The following guide shows more about this: Show or Hide multiple fields at once using form collapse tool

    - This would only work if the fields of the same group are one next to the other, but the suggestion above about 3 individual conditions will work with it and on its own.

    Now in regards to your question about why it does not search. If you have "ALL" (must match) rule, then it will check all of them, but if not, and you have "ANY" then the first match will be enough. It is also resource intensive to search for something if a match has already been found unless specifically set to be so.

    Hope this helps and gives you more details in regards to the same.

  • Profile Image
    Answered on March 21, 2016 at 09:23 PM

    I made a sample form using the conditions as suggested by Ben, I see this is working perfectly. 

    Here is my sample form if you want to test it: https://form.jotform.com/60807642042955

    Feel free to clone it

    Regarding to the note on the guide, it is because if you set the collapse to be closed you are not able to open it using conditions, then it will not show the fields inside it, if the visibility is hidden then even if you set the conditions to show it, the collapse will not be shown, then combining this condition, if status is closed and visibility hidden, you may set a condition to show it based on a selection/input, but it will not display anything, it should be at least with status open. 

  • Profile Image
    Answered on March 22, 2016 at 07:04 AM

    Thanks very much. I've just tried my form again, and suddenly it works correctly. Goodness knows what was wrong when I started this thread.

    However it really is NOT true that a collapse region cannot be made visible by a condition when initially set to hidden and closed. Take a look at https://form.jotform.com/60812944043957 . This is based on your simple form, but uses form collapses. It works fine for me.

  • Profile Image
    Answered on March 22, 2016 at 08:49 AM

    It's great to hear that your form is now functioning correctly, thank you for keeping us updated.

    On regards to the Visibility:Hidden and Status:Closed combination, you are absolutely correct - show conditions will at present display a form collapse tool even if its status is "Closed". This is similar to how a show condition can now force a field to show, even if it was set to be hidden in its properties.

    This wasn't always the case. If you had set a form field to be hidden through its properties in the past, it could not be made visible - not even with conditional logic. I believe that is when the sentence was added to the guide, and the sentence still applies when you are not using the show conditions to conditionally display that form collapse.

    However, as you said, it should be slightly rephrased in the current guide to better match our current behavior. Thank you for noticing it and letting us know. :)