Friday, September 27, 2013

Restricting User input Uppercase OAF OAMessageTextInputBean

 Recently found the necessity to constraint user input to uppercase on a OAF page. I wanted to do without changing underlying VO or EO so other objects using the VO aren't affected. I found some solutions on the web using CSS. This works but the data doesn't persist to the database in UPPERCASE just displays uppercase.

 Se this example;
     http://oracleanil.blogspot.com/2010/10/restrict-user-to-enter-data-in-caps.html

 In order to persist the data you have to add an additional javascript to use the string's function to actually MAKE it Uppercase.

So in order to achieve all the functionality do the css part noted on the link and add the following code too to the Message text box;

MyTextBox.setOnKeyUp( "javascript:this.value=this.value.toUpperCase();");