Only allow uppercase entry in KoBoCollect

Bonjour,
Je suis un nouveau débutant dans kobo mais suis heurté à des petites difficultés qui ne me bloque d’avance dans la conception de mon formulaire.

  1. Comment parvenir à n’autoriser que l’utilisation du majuscule par l’enquêteur lors de la recolte des données;
  2. Bloquer l’utilisateur pour que lorsqu’il fait la saisie, cela ne puisse pas dépasser autant des caractères (Par exemple qui ne puissent pas saisir nom ayant au délà de 10 caractères, losqu’il arrive au 7ème caractère, la base des données ne continuent plus). Vos réponses me sont nécessaires même sur mon adresse mail : alphonsebagalwa@gmail.com

[allow only the use of the capital letter]

On most devices you strictly wont be able to prevent users from typing in lowercase letters on the keyboard, but you can prevent these from being accepted as input; that is, the user wont be able to submit the form until they are removed. Use a suitable regex constraint. eg

constraint = regex(., '^[^a-z]+$')

Explanation:

^ asserts position at start of a line.

Match a single character not present in the list below [^a-z]+

  • + Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)

  • a-z a single character in the range between a (index 97) and z (index 122) (case sensitive)

$ asserts position at the end of a line

[Block the user so that when he / she is typing, this can not exceed as many characters (For example, who can not enter a name with more than 10 characters…]

Similarly, you cant strictly block the user from typing, but you can prevent submission if the text exceeds a certain length with a suitable constraint using string-length(). eg

constraint = string-length(.) <= 10

1 Like

Merci beaucoup chers tous. vos suggestions m’ont beaucoup aidé, ça fonctionne déjà sauf que ça ne fait pas la séparation des noms (Exemple : CLAUDE DE ROY différent de CLAUDELEROY)

If you wish to exclude lowercase letters and spaces, try

constraint = regex(., '^[^a-z ]+$')

(note the addition of a space inside the square brackets)

1 Like