Struggling with defining conditions

Hi, everyone.

I’m having a hard time setting up the conditions for actions to take place upon an OnFocus interaction on a text field.

Consider the following elements (listed as arranged in the prototype):

errorInvalidPhoneInfo (Rectangle, hidden),
errorRequiredPhoneInfo (Rectangle, hidden),
inputPhoneInfo (Text Field, max length=20),
btnSubmit (Button)

Here is the situation, I need the errorInvalidPhoneInfo to be shown if:
inputPhoneInfo.length = 10
or
inputPhoneInfo.length >= 15
and
visibility of errorInvalidPhoneInfo = false
and
errorRequiredPhoneInfo = false

The other conditions have the same structure, the thing is that I haven’t been able to set the conditions given that in the Condition builder allows to either meet all/any of the conditions and as shown above I have AND and OR mixed in the same condition.

Maybe it is much simpler than what I think but I’m really stuck with this so I would appreciate any help.

:pray:

Thanks in advance.

I get what you’re trying to do in general, but not sure I follow the logic of your pseudo-code.

Is it (condition 1) or (condition 2 and condition 3 and condition 4)?
Or is it (condition 1 or condition 2) and (condition 3 and condition 4)?

Why would a 10 digit phone number be invalid?

If you are showing a widget you don’t need to test if that widget is already hidden or shown. If it is already visible, showing it will do nothing. That would simplify your logic here.

But back to your general issue of complex conditions. Since Axure doesn’t support nested if-then statements, you have to build all your unique conditions into multiple Case statements, often retesting for the same things, just in different combinations. For example:

Case too short tests for: [quote=“designerd, post:1, topic:52551”]
inputPhoneInfo.length = 10
[/quote]

Case too long tests for: [quote=“designerd, post:1, topic:52551”]
inputPhoneInfo.length >= 15
and
visibility of errorInvalidPhoneInfo = false
and
errorRequiredPhoneInfo = false
[/quote]

Or, you can use separate widgets/events to perform “sub-tests” which would otherwise be nested. For instance, you could have a hidden widget with an OnMove event that tests your text field only for length, another one that tests only for digits, another that tests for acceptable alpha chars, like { (, ), +, … }. However, with good “If … else if” structure, you can usually get by.

Here is a quick .rp file with what I think you are describing, using your logic–as I understood it–on the Home page. See Page 1 for a more realistic validation test with more conditions and more error messages to deal with. This is also not quite right nor complete, of course… just a quick demo.

ValidateNumberWithConditions.rp (83.5 KB)

It’s a mixed condition like this. I managed to make it work with several combinations of conditions. Thanks for your help.