How do I change user input to upper case on a form?

I have an attribute which should be in uppercase. Rather than complaining if the user enters lower case, is there any way to automatically fold the input to uppercase?
2 answers


You can add a microflow which is triggered 'On Change' event on the input field or 'Before Commit' on the object. In the microflow you change the object's attribute as followed:

  1. Create the first variable and set it as substring('attribute', 0, 1) which results in 'a'
  2. Change the first variable: toUpperCase('a') which results in 'A'
  3. Create a second variable and set it with the attribute excluding the first letter ('ttribute')
  4. Set the object's attribute with the first variable + the second variable.

If you want to set all the characters to uppercase, you can add a before commit event (microflow) which set the attribute to uppercase completely (toUpperCase('attribute'), which results in 'ATTRIBUTE').

Hope this will help you!

@ Jaap's answer:

Jaap is absolutely right about the input mask in case of a fixed length.


Although Fedor's solution is nice it has, in my opinion, some issues.

First of all the "On change" event on an input field will only be triggered after the input field loses focus. In other words when user enters a value into the input field and presses the save button immediately after the "On change" event will not be triggered. Therefore it is better to give the object an "Before commit" event instead.

EDIT: Jasper corrected me on the above. "On change" works properly in 2.4 and not as I described above so you can just as well use the "On change" event here after all.

Secondly creating 2 variables is unnecessary, the same result can be achieved without adding any variables. Assume the object is called "Car", the attribute "Brand" and the user input is "ferrari". In your flow you should have a change action on "Car", select the attribute "Brand" and enter the following: toUpperCase(substring($Car/Brand, 0, 1)) + substring($Car/Brand, 1). Voila, the same result ("Ferrari") without using even 1 variable.

In case of an attribute with fixed length (ie. 10 characters) you could also opt for an input mask on your input field. In this example your input mask would be: ULLLLLLLLL (U = uppercase letter, L = lowercase letter).