Anil's Blog is Best Viewed on GOOGLE CHROME

Friday, October 8, 2010

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.

import oracle.cabo.style.CSSStyle;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
      CSSStyle css =new  CSSStyle();
             css.setProperty("text-transform","uppercase");
             OAMessageTextInputBean mtib=(OAMessageTextInputBean)webBean.findChildRecursive("HelloName");
             if(mtib!=null) {
             mtib.setInlineStyle(css);           
             }


Thanks
--Anil

5 comments:

  1. As per the Option 1 given we are able to force the user to enter the data in CAPS but while saving it saves how the user has typed and does not conert into uppercase.Is their any way to get it saved in the Uppercase itself

    Appreciate your help.

    Nandhi

    ReplyDelete
  2. Hi Anil,
    I did this using the first approach but when the data gets saved in backend it does not get saved in uppercase; rather it get saved as I type in the data. I need to this for whole address part on Customer form on R12. Please suggest.

    Thanks
    Dey

    ReplyDelete
  3. Any update on this last post Anil

    ReplyDelete
  4. Hi,

    I have the same problem with approach 1 (text is saved as it's been written). Does the second approach truly solve the issue?

    Thanks!
    Jose.

    ReplyDelete

Note: Only a member of this blog may post a comment.