Force upper or lower case in a field

Hello,
I would like to force the letters of a field to upper case. For example, the user enters “name” and it displays “NAME” or the display is done after validation of the field.
And the same from upper case to lower case.
Cordially.

You can use CSS. First enable jquery
image

Then in JS (script) of the form designer specify which text field you want to force uppercase using the css property text-transform
image

By the same token you can control text to lowercase

Merci pour votre réponse.

It works well when I enter the data, however when I refresh the screen, the data goes back to lowercase.
How do I keep the data entered in capitals?

Bonjour Bertrand,
Ce n’est peut être pas le plus optimisé mais voici comment je ferai :
→ Au niveau du champ texte dans le formulaire, j’ajouterai un “custom attibute” : un autopostback avec l’event “ontextchanged”

→ Dans mon code, la fonction GoUpper prendrait mon texte et le passerai en majuscule :

void GoUpper(object sender, EventArgs e)
{
    S1_TEXTE1.Text = S1_TEXTE1.Text.ToUpper() ;
}

Cdlt

That works too. You can genericize the method for multiple textboxes

void GoUpper(object sender, EventArgs e)
{
TextBox txtbx = (TextBox) sender;
txtbx.Text = txtbx.Text.ToUpper() ;
}

1 Like

That’s a better solution without doubt !

Merci à tous, cela fonctionne très bien. :ok_hand: