Wednesday 10 July 2013

Submitting the Page on Enter Key - OAF--passing param Hash Table


If you have a case where you want to submit the form when the user selects the Enter key.

So we will make the use of OABoundValueEnterOnKeyPress API & will associate ON_KEY_PRESS_ATTR attribute with the bean that needs to submit the page when ENTER key is pressed


  1. import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;  
  2. import java.util.Hashtable;  
  3. import oracle.apps.fnd.framework.webui.OABoundValueEnterOnKeyPress;  
  4. import oracle.apps.fnd.framework.webui.OAWebBeanConstants;  
  5.   
  6.   
  7.   
  8.   
  9. public void processRequest(OAPageContext pageContext, OAWebBean webBean)  
  10.  {  
  11.    super.processRequest(pageContext, webBean);  
  12.   
  13.     //Enter Button Handling  
  14. //HelloName is the Id of the bean in which user will enter some value and press Enter Button  
  15. OAMessageTextInputBean HelloName = (OAMessageTextInputBean)webBean.findChildRecursive("HelloName");  
  16.   
  17. if (HelloName != null)  
  18.  {  
  19.    Hashtable params = new Hashtable();    
  20.    params.put ("Go""Go");   
  21.    HelloName.setAttributeValue(OAWebBeanConstants.ON_KEY_PRESS_ATTR,  
  22.        new OABoundValueEnterOnKeyPress(pageContext,  
  23.            "DefaultFormName",  //enclosing form name  
  24.             params,   
  25.             true,  //client validated  
  26.             true)); // server validated  
  27.            }                                        
  28.   
  29.   
  30.   }  
  31. public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)  
  32. {  
  33. super.processFormRequest(pageContext, webBean);  
  34.   
  35. if (pageContext.getParameter("Go") != null)  
  36.     {  
  37.        //Once Enter Key is pressed you can handle it here.  
  38.     }  
  39.   }  

1 comment:

  1. How to capture Ctrl + S event in OAF rather keeping a button and firing event?

    ReplyDelete