How can I combine two IF-clauses with an AND?

  • Profile Image
    hristoph
    Asked on October 05, 2017 at 10:27 AM

    Hello!

    I would like to combine two IF-clauses with an AND. Therefore I created the two IF-clauses and chose "IF all of the IF-rules are matched".

    The result should be, that the next page is hidden (or not).

    Unfortunately if I choose the selected results, positive clause, the next page does not hide.

    Thanks for help!


  • Profile Image
    BJoanna
    Answered on October 05, 2017 at 11:40 AM

    I am not exactly sure what are you trying to achieve. What is an AND?

    Is this the form you are working on https://form.jotformeu.com/72672418481360?

    The form has 4 pages. Do you want to show the pages 2, 3 and 4 based on the options that are selected on the first page?

    If you are working on seem other form, please provide us an ID of that form. 

  • Profile Image
    hristoph
    Answered on October 05, 2017 at 11:56 AM

    Hello Joanna!

    Thanks for your reply! Yes, that's the form I am working on.

    Exactly, I wanna show the pages based on the selection on the first page.

    If one chooses "Tax Refund" AND "Discount Code" the page three should be hidden.

    But that's not working in the way I created the logic. In SQL I use "AND" and "OR" to Combine two clauses for example.....that's what I meant.


  • Profile Image
    BJoanna
    Answered on October 05, 2017 at 12:32 PM

    I made some test and I think that the issue is related to the Image Checkboxes widget that you are using because you have to manually enter the target value.

    However, this is possible to achieve. Please use Does Not Contain conditional state and set your conditions like this, to hide the pages that are not selected. 

    I should also add one more page and move the submit button to that page. 

    Here is my demo form: https://form.jotform.com/72774645579979 

    Feel free to test it and clone it

    Hope this meet what you are looking for. 

  • Profile Image
    BJoanna
    Answered on October 05, 2017 at 01:45 PM

    I am a bit confused. Based on your examples page two should always be shown, but the page two is Hotel delivery. 

    Page 1 - Shouper

    Page 2 - Hotel delivery

    Page 3 - Tax refund

    Page 4 - Summary

    Please clarify. 

  • Profile Image
    hristoph
    Answered on October 06, 2017 at 03:28 AM

    No, page two is "Name & Email". It's shown below "Page 1", yes that's a bit confusing;)

  • Profile Image
    Nik_C
    Answered on October 06, 2017 at 05:29 AM

    I must agree with my colleague here, the issue is that when you're using Image checkboxes and conditions, and you say "If image checkbox equals tax refund AND if image checkbox equals discount" that will not work, because of the manual inputs. So that condition could be true only if the image checkbox equals to, for example, "tax refund discount". I'm just throwing that as an example.

    So the way to go is to check one value only, meaning, the reverse logic my colleague suggested.

    So instead of the above logic, the logic could be "If the image checkbox is not equal to Hotel delivery". And that's the logic that you should use. The problem is if you really need to check if both options are checked since the logic I just provided will not ensure that.

    It is a downside of using the Image checkboxes and conditional logic.

    This, however, would be achievable with regular checkboxes. And since you can insert the images into them, you would have pretty much similar outcome when it comes to user experience and logic will work.

    And that can be done with HTML code in checkbox options:

    And it looks something like this:

    That can be adjusted further, but just as an example. Bottom line, that will allow you to use the conditional logic that you had in mind:

    Here is my test form: https://form.jotform.com/72782695751975

    Please check and let us know your thoughts.

    Thank you!

  • Profile Image
    hristoph
    Answered on October 06, 2017 at 11:08 AM

    Dear Nik,

    thanks for your detailed explanation!

    I just thought ist working now with the regular checkboxes. But now I realise it's still not working correctly. Is there an option to implement a hierarchy?

    Because now it looks like that always the rule with a single condition applies and it is not checked if there is another one (with two conditions).

    For example: If I select the "Discount Code", it always jumps to the last page. Thats right, if nothing else is selected. But if I select "Dicount Code + Hotel delivery" only the Tax refund page should be hidden.

    Did I understand something wrong in your explanation?

    Actually just the "skip"-rule applies now, the others are not working anymore.

  • Profile Image
    hristoph
    Answered on October 06, 2017 at 11:45 AM

    Furthermore I just saw that the pages numbers I can select under "Conditions" don't correspond with the ones we build. 

    Under "Build" I have the Tax refund on page 3. In the dropdown where I create the conditions it's shown on page 4.

  • Profile Image
    BJoanna
    Answered on October 06, 2017 at 11:57 AM

    Pages 2 is still 'Hotel delivery'. Email and name fields are on the first page of the form. 

    You should first move the name and email fields to the second page. 

    Also, I think that you did not use the correct logic. Please check your conditions.

    Based on conditions 3 and 4 if you select Hotel delivery and Tax refund, those pages should be hidden, but I think that you actually want to show them if both options are selected. And condition 5 will overrule other conditions. 

  • Profile Image
    BJoanna
    Answered on October 06, 2017 at 01:13 PM

    You are correct. It seems that one page missing. It is not shown inside of the Form Builder and on the live form, but it is shown inside of the conditions. 

    Did you created this form from scratch or did you clone it? If this is the cloned form, please provide us the original form, so that we can see if we are able to find the cause of this issue. 

    Can you please test this form and see if it is working like you expected?

    https://form.jotform.com/72784635879982 

    This form has only two conditions. 


    To resolve the issue with the page breaks, I deleted all page brakes from the form and I added them again to the form.

  • Profile Image
    hristoph
    Answered on October 16, 2017 at 05:19 AM

    I created the form from scratch. I also deleted and added the page breaks...it looks good now.

    Also the two conditions. If I add one skip-rule i think it will work for us.

    Thanks for your help, Joanna!