Perspective no blanks or spaces in text boxs

I am trying to script so that my 5 text boxes do not accept blanks or spaces and when one is entered and submitted using a button, a pop up comes up. I had the blanks working but I cant find a way to stop spaces.
All help is welcome, thanks.

Out of curiosity, what is the difference between a blank and a space? Do you mean like an empty string ("")?

blank would be ("") and space would be (" ").

So something like this:

text_value_one = self.getSibling('TextField').props.text
if (len(text_value_one) == 0) or (text_value_one == " "):
    # popup

or looping through multiple fields:

all_inputs = []
for value in all_inputs:
    if (len(value) == 0) or (value == " "):
        # popup

Unless you don’t want a space allowed as part of the input, at which point you want in:

text_value_one = self.getSibling('TextField').props.text
if (len(text_value_one) == 0) or (" " in text_value_one):
    # popup
1 Like

Worked out there, thanks for the help

1 Like