How to condition text entry in uppercase

Hello dear Experts, I am designing a xls form.
But I am facing a problem. I have question fields of type "text" and I want to allow only uppercase lettering with a length of 50 or more with spaces. what is the command a to insert in the column "constraint"
How to do this ??

See How to use Uppercase text only in ODK - #2 by Koassi_AKAKPO

1 Like

I inserted the following command but it does not pass


help me please !!

I want that the name contains spaces. For example : KESSE ANGE DESIRE

Hi @ANGE
can you change you constraint to regex(., '[A-Z]{1,50}') this should allow you to enter a capital letter with a length between 1 to 50 digits.

Thanks
Fabla

Thank you, well received but the constraint does not accept my space in the field "name and surname"
I want this command to accept uppercase entries with spaces

To accept spaces you'll need to add a space after the Z:

+--------+---------+-------------------+-------------------------+
|  type  |  name   |       label       |       constraint        |
+--------+---------+-------------------+-------------------------+
| string | nom_enq | No de l'enquêteur | regex(.,'[A-Z ]{1,50}') |
+--------+---------+-------------------+-------------------------+

I would add both a hint and a constraint_message explaining that the question requires only letters or spaces, and needs to be all capital letters. This will help prevent user frustrations/confusion when they are filling out the form.

You might also consider instead converting the case during data cleaning and analysis (and not restricting the input), for example by using the UPPER(text) function in Excel.

There are online tools to test regrex expressions (such as RegExr). If using that site you'll want the whole text highlighted and exactly one match.

Like this:

Not like this:

3 Likes

Thank you for your help.
This is working properly

1 Like