Requirement: Convert af:inputText value to upperCase, lowerCase, and capitalize by setting contentStyle of the af:input text in ADF
Solution: For solution to the above requirement follow the steps as shown below:
Step 1: Create an Oracle ADF Fusion Web Application.
Step 2: Create a demoPage.jspx page in the ViewController project of our application.
Step 3: Open demoPage.jspx page. Add three af:inputTextby drag and drop from the component palette on thedemoPage.jspx. Set the contentStyle for each of the af:inputText as shown below:
The below code will enforce the User to enter text in an upperCase format
<af:inputTextlabel="First Name"id="it2"contentStyle="text-transform:uppercase;"/>
The below code will enforce the User to enter text in a lowerCase format
<af:inputTextlabel="Middle Name"id="it3"contentStyle="text-transform:lowercase;"/>
The below code will enforce the User to enter text in an initCap (capilatize) format
<af:inputTextlabel="Last Name"id="it4"contentStyle="text-transform:capitalize;"/>
Thus, the complete demoPage.jspx code is shown below:
<?xmlversion='1.0'encoding='UTF-8'?>
<jsp:rootxmlns:jsp=""version="2.1"
xmlns:f=""
xmlns:af="">
<jsp:directive.pagecontentType="text/html;charset=UTF-8"/>
<f:view>
<af:documenttitle="demoPage.jspx"id="d1">
<af:formid="f1">
<af:inputTextlabel="First Name"id="it2"
contentStyle="text-transform:uppercase;"/>
<af:inputTextlabel="Middle Name"id="it3"
contentStyle="text-transform:lowercase;"/>
<af:inputTextlabel="Last Name"id="it4"
contentStyle="text-transform:capitalize;"/>
</af:form>
</af:document>
</f:view>
</jsp:root>
Step 4: Save all and run the application . Thus, the ran application is shown below:
Now type First Name as Susanto,Middle Name as Kumar, and Last Name as Paul. So, irrespective of the case we enter in the various af:inputText, the First Name is accepted as SUSANTO, Middle Name as kumar and Last Name as Paul as shown below:
Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
494 total views, 3 views today