Text type should not allow the user to type any number or Special Characters

I am having a column as Text type should not allow the user to type any number or Special Characters

the field should contain only characters,any suggestions

If there were any special characters in your question it could have helped us understand it better.

1 Like

I am having a column name and type is TEXT
i need enter only text into the field ,it should not any numbers like 123
special characters like ,.@#

Please go through this thread.

1 Like

I have faced similar problems in the past. I myself have not found a good compact solution for this yet. And seeing this thread I haven’t asked for one.

1 Like

There’s no easy way to do this in AppSheet. You can use SUBSTITUTE() to remove a single value, but you would have to nest 26 expressions together.

You could try using UPPER(), then SUBSTITUTE() x 26 to remove all letters from the original string. Then, if the LENGTH()>0, you will know there are other characters remaining.


Here are a few related feature requests in case you’d like to vote for better text parsing tools.

2 Likes

One other option is using a spreadsheet formula with REGEXMATCH. However, the formula result will not be applied until sync, so the user will not see that they are entering an invalid value.

You would have to allow the invalid value, then trigger a delete or notification to the user if the validation failed.

1 Like

As possible workaround, prepare column(s) validity checks.
First check for if or not it incluing the number with expression something like count(EXTRACTNUMBERS([Col1]))

If this number is > 0 then obviously the user is typing some number in the text/longtext fields.

likewise, number of contain expression to check if the special characters are in or not.

Upon failing those test, the user can not save the form at the end.

1 Like

And include them in the Valid_if expression?

Yes
Writing number of contain expression is a bit of pain though.

I am getting a error

The expression is valid but its result type ‘Number’ is not one of the expected types: Yes/No, List

How did you get to this error? Otherwise we wont be able to put comment…

AND(
	NOT(
		CONTAINS(
			[ColA],
			{"0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9"}
		)
	),
	NOT(
		CONTAINS(
			[ColA],
			{"@" , "," , "." , "|" , "!" , "_" , "-" , "<" , ">" , "&" , "#" , "(" , ")" , "[" , "]" , "*"}
		)
	)
)
2 Likes

Clean and neat.

1 Like

This won’t work. CONTAINS() converts the list to text, so the first becomes:

CONTAINS([ColA], "0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9")

which is unlikely to ever be true.

1 Like

Thanks for your wise input @Steve, much appreciated.

1 Like

Which expression i need to use ??

@Gunasuriya_Ravi
Aren’t you following the posts under this thread? What isn’t clear to you?

1 Like

LeventK,i was wondering that above expression i have used in valid If section ,its coming error again has LIST has elements of mismatched types.

Which expression is giving the error?