JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
How can I create a condition on a matrix?Asked by cgalarza on September 29, 2016 at 10:06 AM
I have a matrix titled Health History Past or Present on my form: https://form.jotform.com/62645906652159. The first ten choices have an asterisk next to it to indicate to parents that if they select YES to any of those asterisk items then we are going to need an additional form to be filled out. I have two autoresponders emails set up. One is for everyone who hits submits will receive. The 2nd is identical to the first except I want anyone who marks YES to any of the asterisk items in the matrix to receive the 2nd email which has the additional form they need attached instead of Email 1.
I was trying to figure out how to set up the condition to do this but I wasn't able to figure it out. Will I have to make 2 separate matrixes? One for the asterisk items and the other for those who don't require an additional form?
Unfortunately, you cannot set it up like this:
The reason is because your first "IF" statement cannot identify the "*" on the value of the matrix field, because the answer depends on the column selected. In your case, the columns are "YES" and "NO". Another problem is that the matrix field consists of multiple rows, meaning it does not output a single input, meaning have the 2nd "IF" statement will not work because you have multiple rows.
What might work is setting up a form calculation widget to fetch the input for the rows with "*".
1. First, add a form calculation widget in your form. This is the field that will fetch all the input from rows 1-10 of your matrix field.
2. Now in the widget setting, add the specific rows from the matrix field that needs to be checked or evaluated. Use the "Add Field" button. Here's a screencast to show how I added mine:
- Make sure to set the input type from "0-9" to "A-Z".
- Separate each field with a space or a comma.
3. The final output would look like this:
4. In your live form, you can see that the first ten rows (the ones with the asterisk will have the inputs in your form calculation widget.
5. Now based from that widget, we can now rewrite your conditional logic for the autoresponder to something like this:
So what my condition states that if the field "Rows 1-10" widget CONTAINS a value of "YES", meaning any of the rows has an answered "YES", then send the "Autoresponder - Doctor's note" to the specific address.
I hope that helps.
Note: You need to specify the email field name in your conditional logic to where to send the autoresponder. You can learn more about the conditional logic for email alerts on this guide: https://www.jotform.com/help/167-How-to-Send-Email-Based-on-Selection