Anil's Blog is Best Viewed on GOOGLE CHROME

Saturday, October 2, 2010

Submitting the Page on Enter Key - OAF

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.
    }
  }

1 comment:

  1. Hi Anil

    Please update this entry so that anyone who is referring may get to know what is HelloName here and how they have associated it to submit the page on enter button.

    Thanks
    AJ

    ReplyDelete

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