Saturday 20 July 2013

Restrict user to enter data in CAPS ONLY

Thanks Pranav for sharing this article.

In this exercise we are restricting the user to enter Character in UPPERCASE.



Brief about the steps we are performing
1. Create custom CSS.
2. Attaching this CSS to bean via personalization.


Step1. FTP the latest custom.css from server $Common_Top/html/cabo/style to desktop

Step2. Add the below text in custom.xss





Step 3: Now, FTP the updated custom.xss file to same path on the server i.e. $Common_Top/html/cabo/style.


Step 4: Set the CSS Class Property through Personalization.

CSS Class : XXOraUpperText



Finally after setting css for Project Name bean user can only enter in UPPERCASE only.




Here is another more simpler approach.

Here in the processRequest we are setting the CSS to the Bean without making changes to custom.xss file.

  1. import oracle.cabo.style.CSSStyle;  
  2. import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;  
  3.   public void processRequest(OAPageContext pageContext, OAWebBean webBean)  
  4.   {  
  5.     super.processRequest(pageContext, webBean);  
  6.       CSSStyle css =new  CSSStyle();  
  7.              css.setProperty("text-transform","uppercase");  
  8.              OAMessageTextInputBean mtib=(OAMessageTextInputBean)webBean.findChildRecursive("HelloName");  
  9.              if(mtib!=null) {  
  10.              mtib.setInlineStyle(css);             
  11.              }  

1 comment:

  1. Hi All,
    We have to write the code in ProcessFormRequest to save the text in to CAPS in the database. Please find the prcess below
    find the VO associated to that field and add this piece of code in the extended controller and replace the VO .

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) {
    OAApplicationModule oaapplicationmodule2 = pageContext.getApplicationModule(webBean);
    OAViewObject oaviewobject = (OAViewObject)oaapplicationmodule2.findViewObject("HzPuiOrganizationProfileQuickAM1.HzPuiOrganizationProfileQuickVO");
    if(oaviewobject != null)
    {

    Row row = oaviewobject.getCurrentRow();
    if(row != null)
    {
    row.setAttribute("OrganizationName", row.getAttribute("OrganizationName").toString().toUpperCase());
    }
    }
    super.processFormRequest(pageContext, webBean);

    ReplyDelete