How to set up conditions based on options selected in the table?

  • purecoldpress
    Asked on March 1, 2017 at 4:28 PM

    I've managed to get conditionals to work if any checkbox in Column C is selected, but when I try to create a second conditional that gets triggered when any checkbox in Column A is selected, it refuses to work. I am doing the exact same thing for Column A that I did for Column C, so I don't understand why one works and the other does not. Am I doing something wrong in the construction of my conditionals?


    Here are screenshots of my conditionals. I have fields "Custom Size" and "TEST" hidden and I want "Custom Size" to appear only if "Custom" column is chosen and I want "TEST" to appear only if "Small" column is chosen.

    How to set up conditions based on options selected in the table? Image 1 Screenshot 40

    As soon as I test my form, I can tell something is wrong because the hidden field "TEST" is showing even if there is nothing selected in the table. 

    How to set up conditions based on options selected in the table? Image 2 Screenshot 51

    However, if I select something in the "Custom" Column, "Custom Size" field will pop up. Which is exactly what I want to happen. 

    How to set up conditions based on options selected in the table? Image 3 Screenshot 62

    I can't figure out why one of my conditionals works perfectly while the other doesn't work at all when I implemented them both in exactly the same way. Any suggested solutions?

    Also, am I constructing my conditionals wrongly? I couldn't find much information on how to properly write conditionals for table inputs. Is there a way to say if the checkbox in the "Salad Only" row and "Small" column is selected, show field X. Then, if the checkbox in the "Salad Only" row and "Medium" column is selected, show a different field Y. Is this possible?

    Thanks.

  • Kevin Support Team Lead
    Replied on March 1, 2017 at 6:41 PM

    I have checked the conditions you show in your screenshots and I can see they're working on my end, do note that the value in the "If" statement needs to be exactly the same as the one in the input table.

    Here's a screen-cast about how it works on my end: 

    How to set up conditions based on options selected in the table? Image 1 Screenshot 70

    This is how I have set up my conditions: 

    How to set up conditions based on options selected in the table? Image 2 Screenshot 81

    But do note that setting up conditions in this way will trigger it no matter the row where the option is selected, for example, the selected option could be "Salad Only" and "Small", so it means the condition will trigger only once and you cannot set up conditions per row. 

    However, a workaround would be to use the Form Calculation widget to capture the selected value of each row. 

    How to set up conditions based on options selected in the table? Image 3 Screenshot 92

    Once the widget has been added you can include the options in a row of the input table, here's a screen-cast for further reference: 

    How to set up conditions based on options selected in the table? Image 4 Screenshot 103

    The values will be added as numbers by default, but you can click on them to convert the result to text, you can also separate each value with a comma or space if needed: 

    How to set up conditions based on options selected in the table? Image 5 Screenshot 114

    You must do this if you need to copy the string selected in the matrix field, otherwise you will get only 0 values. 

    Now, when you select a value or all the values in the selected row they will be added to the calculation widget, this will help you to know the selected option/options in a single row so you can set conditions based on this, depending on the selected option in the first row show some fields and so on. 

    How to set up conditions based on options selected in the table? Image 6 Screenshot 125

    Here's my sample form where you can see the conditions working as well as the calculation widget: https://form.jotform.com/70597459745978 

    This guide will help you to clone it if you want: https://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL 

    If you have any question, please let us know. 

  • purecoldpress
    Replied on March 1, 2017 at 11:30 PM

    Thanks for your quick response! The Form Calculation Widget was the exact solution I was looking for. 

    I tried using it just now, though, and for some reason when I click on "Add Field" and select my table, it shows me all the rows but none of the columns. In place of the columns it says "Use?". Refer to screenshot below. Is there something else I must do?

    How to set up conditions based on options selected in the table? Image 1 Screenshot 20

    Thanks again!

  • purecoldpress
    Replied on March 1, 2017 at 11:34 PM

    Nevermind, I figured it out. I had changed the format of my table to radio buttons. When I changed it back to checkboxes I got the desired result.

    Thanks again! 

  • Ashwin JotForm Support
    Replied on March 2, 2017 at 2:22 AM

    Hello purecoldpress,

    On behalf of my colleague, you are welcome. I am glad to know that your issue is resolved and your form is working as expected.

    Do get back to us if you have any questions.

    Thank you!