Sunday 24 November 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

import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;  
import java.util.Hashtable;  
import oracle.apps.fnd.framework.webui.OABoundValueEnterOnKeyPress;  
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;  
  
  
  
  
public void processRequest(OAPageContext pageContext, OAWebBean webBean)  
 {  
   super.processRequest(pageContext, webBean);  
  
    //Enter Button Handling  
//HelloName is the Id of the bean in which user will enter some value and press Enter Button  
OAMessageTextInputBean HelloName = (OAMessageTextInputBean)webBean.findChildRecursive("HelloName");  
  
if (HelloName != null)  
 {  
   Hashtable params = new Hashtable();    
   params.put ("Go""Go");   
   HelloName.setAttributeValue(OAWebBeanConstants.ON_KEY_PRESS_ATTR,  
       new OABoundValueEnterOnKeyPress(pageContext,  
           "DefaultFormName",  //enclosing form name  
            params,   
            true,  //client validated  
            true)); // server validated  
           }                                        
  
  
  }  
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)  
{  
super.processFormRequest(pageContext, webBean);  
  
if (pageContext.getParameter("Go") != null)  
    {  
       //Once Enter Key is pressed you can handle it here.  
    }  

  }  

No comments:

Post a Comment