Environment (JDeveloper 11.1.2.2.0,ADF Faces)
Sometimes you need to force the user to enter upperCase or lowerCase or capitalize letters for input text component. fortunately, there is an easy way to do this by setting contentStyle of the input text.
- To enforce the user to enter upperCase text use this style:
<af:inputText label="Label 1" id="it1" contentStyle="text-transform:uppercase;"/>
- To enforce the user to enter lowerCase text use this style:
<af:inputText label="Label 1" id="it1" contentStyle="text-transform:lowercase;"/>
- To enforce the user to enter capitalize (InitCap) text use this style:
<af:inputText label="Label 1" id="it1" contentStyle="text-transform:capitalize;"/>
Good solution. But a problem- when I used it, the input text works as mentioned above but on commit it doesn’t post changes to database,i.e it still remains in the entered format though it shows on the page as Uppercase/Capitalized. Is there a way it could post the changes using this way?
Good Catch.
I was not aware of this :).
You can try the solutions mentioned in this blog
http://one-size-doesnt-fit-all.blogspot.com/2007/06/i-rest-my-case-converting-adf-bc-eovo.html
Hey Jabr,
Thanks for the link.
I just modified ViewRowImpl’s setter method for the attribute for uppercase along with the ‘text-tranform’ you mentioned and it worked. 🙂
public void setCountryName(String value) {
setAttributeInternal(COUNTRYNAME, value.toUpperCase());
}
but for initcap it is not working.in database it is not saved as in initcap
Please check the comments above