28 October 2009

Case static fields

At the beginning let’s do something easy but quite useful if you want to force user to use upper or lower case letters in text field.
We can achieve it in two ways – by using javascript or CSS. I prefer second method because it's more “pure” in my opinion.
Create text item (P1_TEXT) in your page. Go to item details and find HTML Form Element Attributes. Write there new style or add following attribute to existing one:

style="text-transform: uppercase;"

Of course instead of “uppercase”, you can use “lowercase” option. Accept changes and the only letters you can enter in P1_TEXT are upper.
If you want to use javascript you should add to the same HTML Form Element Attributes field, following JS code:


Apply changes and now every time you click some key on P1_TEXT, its value will be changed dynamically to upper case.

No comments: