Oracle APEX : Input Field with ALL Capital Letters

This is a mini-tip on changing characters entered in a text/input field to all Capital letters. A little use of Javascript is required. Navigate to the page where the changes is required. Click on the field/Item for which all capital characters is required. Scroll till you reach Element section and in "HTML Form Element Attributes" mention the following (including quotes):


Now Click on Apply Changes button and run the page. For the field this attribute is applied, whenever a key is typed the case is changed. But if you dont want this type of animation and just want all characters to be in upper case no matter what, add the following to the text field:

style="text-transform: uppercase;" onKeyUp="this.value=this.value.toUpperCase();"

To learn more about text-transform click here.

The style attribute is a CSS property and applies an all UPPER CASE property to the text field. Even though the style attribute is applied the value which will be passed to server may not be uppercase. Only if the user has CAPS lock turned on the value will be passed to server as UPPERCASE, otherwise it will be case in which user typed in. So to make sure that the user typed value also gets modified to UPPERCASE we have a javascript to change value.

Edit: June 1st, 2018

In Apex 5 and later the attribute to put the above is not "HTML Form Element Attributes", but "Custom Attributes" below Advanced section.

1 comment :

  1. the values are stored in lowercase.... so it doest work.... this is only for displaying purposes...