# IF - OR - AND logic possible?

• wmontroy
Asked on December 11, 2013 at 06:48 PM

Hello!
Currently, it appears I can only set one IF and AND in the following format:
IF ( X = Y )
AND  ( A = B )
IF ALL (SHOW SECTION X)

However, I'm trying to create the following condition:
IF (X = Y )
OR ( X = Z)
AND ( A = B )
IF ??? (SHOW SECTION X)

ALL doesn't seem appropriate in the above condition, and neither does ANY.

Is creating that condition possible?

• jonathan
Answered on December 11, 2013 at 08:42 PM

Hi,

This rules

IF (X = Y )

OR ( X = Z)

AND ( A = B )

IF ??? (SHOW SECTION X)

is still possibe in the current condition wizard of the form builder.

That is by creating 2 separate rules for each instead.

something like this

IF (X = Y )

IF ( X = Z)

IF ANY Then (SHOW SECTION X)

--

IF (X = Y )

IF ( A = B )

IF ALL Then (SHOW SECTION X)

--

We can assist you further if you can share to us the URL of your form you wanted this rule tried out.

Thanks.

• abajan
Answered on December 12, 2013 at 02:38 AM

@wmontroy

This is one of those puzzles which intrigue me. I saw your question earlier and was trying to figure out a solution but nothing worked. Initially, I thought that using the following separate rules would work:

IF X = Y AND A = B
IF X = Z AND A = B
SHOW (Whatever)

because in my mind that's equivalent to

IF (X = Y OR X = Z) AND A = B
SHOW (Whatever)

but it failed. So, feeling rather sleepy at the time, I "hit the sack". But while I slept my mind must have been trying to solve the problem because I suddenly awoke in the middle of the night (it's really early here!) and thought "Eureka!": Use a single condition with multiple rules, each with a Not Equal To condition.

This form illustrates what I mean. Its text area will be shown only if

(X = Y OR X = Z) AND A = B

If you clone the form you'll see that it has just the following condition:

I don't know the specific form to which you want to apply the logic but use the condition in my demo as a guide and let us if it works.

Thanks

• wmontroy
Answered on December 12, 2013 at 11:24 AM

Ah! Thank you for help, but neither of those solutions will work in my case.

This is the actual form: http://form.jotform.co/form/33454308898870?

Name of MLS Board can have dozens of possible entries, so I cannot easily do a NOT Equal condition. What I would like to happen is when Name of MLS Board is equal to either ARMLS OR Metrolist AND Do you want an MLS search page? is equal to YES to show the MLS Details section.

My set conditions:

Currently, the details section only triggers when ARMLS is input, and not Metrolist.

Thoughts?

• abajan
Answered on December 12, 2013 at 01:07 PM

We'll see what we can come up with but in case we discover that there's no way to accomplish the desired functionality via the form builder, do you have a web page within which the form's source can be embedded? I'm asking this because I believe a custom script can be fairly easily created for this. The script would be inserted in the same web page.

• wmontroy
Answered on December 12, 2013 at 01:30 PM

We may be able to setup an external page, but ideally we'd like to run it directly from JotForm (as edits are easier to make and test without having to continually export). If we can't do it directly from JotForm, please add a feature request! It's a bit surprising to me that it hasn't already been implemented as it seems like it could be a common issue :)

Answered on December 12, 2013 at 03:21 PM

Unfortunately, I don't know of this being possible directly on your form. The only way that would become relevant to working is if our Developers considered adding this as an Improvement for your use on our Platform.

I will go ahead and pass this along to our Developers to look over more as I don't really see any other way around it without using the source and re-embedding it. I feel that a Feature Request for it on your behalf is much more feasible so that it might become a reality for use directly on the form itself. However, be advised that I won't be able to provide any such timeframe for this but should this become an additional ability then we'll certainly let you know about it here.

• wmontroy
Answered on December 12, 2013 at 05:46 PM

Very much appreciated! Thank you. I'll keep an eye out for updates.

• abajan
Answered on December 12, 2013 at 09:01 PM

Hi again,

In case you decide to go the route of embedding the full source, here's a script that would work. It's the same one that's used in this demo. (It can be seen near the bottom of the page's source.)

This solution allows users to enter "ARMLS" and "Metrolist" in a case insensitive fashion ("ARMLS", "aRmlS", "ArmLs", "MEtroLiST", "metROLISt", "METROLIST" etc.) but the script can be easily altered if you want only ARMLS and Metrolist to reveal the hidden fields. Also, there's a quick flash of the hidden fields on initial page load. That's because the the HTML has to load before the script can hide the relevant fields. That can be corrected if necessary.

Cheers

• dragonfly0928
Answered on February 02, 2014 at 01:56 PM

Hello, I would just like to second the request for IF-AND-OR logic.

I'm using JotForm to create an RSVP form and it has been fantastic so far, except for this one hiccup.

I have a field for the guest's name, as well as a field for a plus one name.  However, I only want the plus-one field to show up for certain people.

Ideally, I would want to do a rule like:

IF (lastName = Smith) && (firstName !=Jane)
IF (lastName = Doe) && (firstName != John)
...etc...
IF Any, show plus-one field

But this does not seem possible, even by breaking it into separate rules.

The only workaround I've found is to just list out the full name of everyone who gets a plus-one in a single rule.  While doable, it's rather cumbersome.

I realize this feature proably won't be implemented in time for my form, but I think it's definiltey a common use-case to concider!

• TitusN
Answered on February 02, 2014 at 04:01 PM

You can do this using the text field, rather than the default email field:

Try filling out "John Doe" on this form:

http://jotformpro.com/form/40305576785966

Would that work for you?

If you have unrelated requests to this ticket, please open a new one for more concerted assistance.

Thanks.

• dragonfly0928
Answered on February 02, 2014 at 04:21 PM

I'm not sure how this solves the IF-AND-OR problem.

I'm already using separate text fields for first name/last name, and can rudimentally show/hide the plus one field just fine.

My problem is that I can't make a rule that says "Everyone with the last name Doe gets a guest, except for someone with the first name Jane."

I have already worked around this by listing people individually.  I was just agreeing with wmontroy that this seems like a common use-case and should definitely go on a list of future features.

• TitusN
Answered on February 02, 2014 at 04:35 PM

My apologies,

This was a workaround to get things going as the feature is delieberated on:

I should have pasted the rules I inserted in the test form:

I have modified the rule to allow all people with the last name "Doe" to get a pluls one, all except those with the first name "Jane".

IF First Name Is Not Equal To "Jane"
AND IF Last Name Is Equal To "Doe"
SHOW Plus One

Try out the form once again: http://jotformpro.com/form/40305576785966

In the meantime, the feature has already been submitted for deliberation.

• TitusN
Answered on February 02, 2014 at 04:39 PM

You can add more than one rule to one condition, and you can set it to respond to AND/OR logic:

Hope that helps.

• dragonfly0928
Answered on February 02, 2014 at 04:52 PM

That's the first thing I tried.  The problem is I need multiple of these, e.g.

IF First Name Is Not Equal To "Jane"
AND IF Last Name Is Equal To "Doe"
SHOW Plus One

IF First Name Is Not Equal To "John"
AND IF Last Name Is Equal To "Smith"
SHOW Plus One

IF First Name Is Not Equal To "Steve"
AND IF Last Name Is Equal To "Smith"
SHOW Plus One

When I tried that, only the first one fired.

• Cesar
Answered on February 02, 2014 at 05:10 PM

This is due to calling out the Plus One field on more than one condition. Around how many conditions will you need? Do let us know to figure out this further as using more than one Plus One would make 2 Plus One appear for example in the Smith condition.