How to condition text entry in uppercase

xlsform
form-design

(KESSE) #1

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 ??


(Yaw Anokwa) #2

See How to use Uppercase text only in ODK


(KESSE) #3

I inserted the following command but it does not pass


help me please !!


(KESSE) #4

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


(Abdul-Majeed) #5

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


(KESSE) #6

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


(danbjoseph) #7

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:


(KESSE) #8

Thank you for your help.
This is working properly