Is there a simpler way to detect empty/white spaces?

I may be making a fool of myself via sharing this… But not finding any simpler work around… This is pretty much my solution to my problem (And maybe even help to those in need if this IS the only way).

I took the variable and first counted its contents… And then I trimmed white-spaces and had it count again.
Thus comparing if there is a change in length:

IF(LENGTH(pageVars.password) >= 6 && (LENGTH(TRIM_WHITESPACE(pageVars.password)) == LENGTH(pageVars.password)), true, false)

Basically I do not want the users to present any spaces in their passwords. So such I want to prevent acceptance of the password if there actually is a space bar (Oh and in my case: if it is less than 6 digits)

So this is what I connected
ON EVENT-> Component tap

To run you through it…

When you tap on "Sign Up"

→ The app checks if the password input field is empty:
and IF it is it changes the password text with “Filling this in is mandatory” also changing the text color from theme primary to theme negative (vibrant red tint in my scenario).

→ Upon tapping to retype a password the value is deleted and the text colour reset to its initial.

→ IF the password is not empty… The app checks if there are enough/too many digits AND if there is any blank spaces:
LENGTH(pageVars.password) >= 6 && (LENGTH(TRIM_WHITESPACE(pageVars.password)) == LENGTH(pageVars.password))
and if there is a white space and/or few digits… The same as the above but this time the text changes into a milder “please try again” in themes primary colours with an added warning message stating they need to include at least 6 digits and also that they should not use the space bar.

IF there is a simpler way


Love your documentation, it definitely helps visualize what you’re trying to do.

While I cannot suggest an easier way to do what you already are accomplishing, I can tell you that some of the features I programmed are clunky like this. I move on to my next page, and realize I can make the previous page function the same, using less flow functions etc.

Honestly don’t feel like a fool. ALOT of people are just learning, myself including. I have a background in PHP, Java, Swift etc, and while that helps tremendously, there is still a learning curve.


Hi @Berter_Akyol ,

thank you for sharing your work and documenting it so clearly!

Just as a hint in case you haven’t read it in the docs already: the TRIM_WHITESPACE() function only works for space characters at the begin and at the end of a string. It does not trim spaces within the string. This means that it turns

  • " Hello World ! "
  • to “Hello World !”
1 Like

Great work!

I’d suggest handling the whitespace check with a regular expression, which should also catch other whitespace characters like newlines and tabs as well.

This bit of formula will evaluate to true if the password contains any whitespace:
MATCHES_REGEX(pageVars.password, "\\s")


Thank you SO much!

Worked like a charm! :slightly_smiling_face:
Such a clever (And now knowing what to do… when you think of it: “Almost obvious”) way to check for it… You are my hero of the day :pray:


I actually had had… But none the less since it had had detected the space from the middle and/or the ends of the input data: I had had left it be.
I do not have any explanation to why it always worked. But Oddly: it did.
Maybe one of you can test it to check if it is a fluke/glitch or something on my part.

None the less Pekka_Aaltonen’s method hit the nail on the head!

1 Like

So how exactly do we make sure a password and email has no spaces? what do we place in the value field of the email and password inputs?