<-----Google Analytics Code Start----> <-----Google Analytics Code Close---->
Skip to content

Green

color

Default screen resolution  Wide screen resolution  Increase font size  Decrease font size  Default font size  Skip to content Default color Pink color Green color Green color
Home arrow Home arrow Sample Code - Add Submit Button Using OA Framework Extension
This website has now moved to http://apps2fusion.com





Sample Code - Add Submit Button Using OA Framework Extension | Print |  E-mail
Written by Anil Passi   
Thursday, 17 January 2008
In continuation with previous article, please find a sample source code for enabling a Submit Button on OA Framework Page.
This code will reside in Controller class.

Following sequence of events will take place for this type of extension
The extended custom controller class will replace the standard controller class.
Just prior to the page being rendered, processRequest of extended controller will be called.
In processRequest we will create a Submit Button Bean using getWebBeanFactory(),as in sample below.
Next, we will attach an event named "xxSubmitSendEmailButton" to this newly created button.
In the processFormRequest of extended controller, trap the event named "xxSubmitSendEmailButton"
        Note- Event is trapped by checking the value of pageContext.getParameter(EVENT_PARAM)
Take appropriate action when this event is trapped


The actual code related to button is colour codedin brownish text


//add these import, if not already exist
import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;


//First create the Submit Button
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    //first excute standard functionality by call super as below
    super.processRequest(pageContext, webBean);
    //now create new button programatically
    OASubmitButtonBean oasb= (OASubmitButtonBean)pageContext.getWebBeanFactory().createWebBean(pageContext,"BUTTON_SUBMIT");
    oasb.setID("xxSubmitSendEmailButton");
    oasb.setUINodeName("xxSubmitSendEmailButton");
    oasb.setEvent("xxSubmitSendEmailButton");
    oasb.setText("xxSubmitSendEmailButton");
    webBean.addIndexedChild(oasb);
  }

  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
  super.processFormRequest(pageContext, webBean);
  String strEvent= pageContext.getParameter(EVENT_PARAM) ;

  if ( strEvent.equals("xxSubmitSendEmailButton"))
  {
    //IMPORTANT Get this by calling the Function that loops for records.
    //The string will contain the concatenation Email for which STANDARD CHECKBOX WAS CHECKED
    String strEmailStringLearner = "passi.anil@gmail.com;go4gold@gmail.com" ;
    pageContext.setForwardURL("xxMailOTA.jsp?paramEmailLearner="+ strEmailStringLearner,
                             null, // not necessary with KEEP_MENU_CONTEXT
                             OAWebBeanConstants.KEEP_MENU_CONTEXT, // no change to menu context
                             null, // No need to specify since we're keeping menu context
                             null, // request parameters
                             true, // retain the root application module
                             OAWebBeanConstants.ADD_BREAD_CRUMB_YES, // display breadcrumbs
                             OAException.ERROR); // do not forward w/ errors
  }}
   
3. On your PC, in <JDEV_USER_HOME>/myhtml/OA_HTML
create a jsp file xxMailOTA.jsp, with below contents
<head>
    <script type="text/javascript">
  function xxRzbCallEmail(paramEmailLearner){
  document.location.href='MailTo:'+paramEmailLearner;history.go(-1);
  }
    </script>
</head>

<%
String paramEmailLearner = request.getParameter("paramEmailLearner");
System.out.println ( "paramEmailLearner=>" + paramEmailLearner ) ;
%>
<body onload=xxRzbCallEmail("<%=paramEmailLearner%>")>
</body>

IMPORTANT NOTE: This will be deployed to the $OA_HTML on server, when testing from eBusiness Suite


Overall Flow for business case
1. The processRequest of Controller will create a Submit Button, as it can't be done using Personalization.
2. In processFormRequest of Controller, when Submit Button is clicked, the value in StandardCheckbox will go into the corresponding View Object Attribute
3. We will loop for those records and calculate Concatenated Email String strEmailStringLearner
4. On Submission of Page, we will call xxMailOTA.jsp
5. xxMailOTA.jsp will do two things
    a. Invoke MailTo on load of the jsp page
    b. Send the navigation back to the main page


Comments (7)add
How do you specify the position of the submit button while creating the submit button getWebBeanFactory()
written by Suneetha , January 17, 2008
Hi Anil,

As always great stuff.. I have one question though.. How do you specify, if you want the button to be created at a specific location ( may ne next to a set of buttons which are already on the standard page)..

Thanks for all your help,
Suneetha.
...
written by Anil Passi , January 17, 2008
Hi Suneetha

In the above sample, we are using webBean.addIndexedChild(oasb)
This means that button will be added at the end of the page itself.

However, instead, you could also do, anyBeanOnPage.addIndexedChild(oasb)
You can add further parameters to addIndexedChild, so as to dictate the position within the parent container.

For example, a pseudo code is

Main Page Bean Structure
Region1
Region2
StackLayout for Buttons

===========================


//First locate StackLayout for Buttons
-----------------------
OAStackLayoutBean oslb=(OAStackLayoutBean)webBean.findIndexChildRecursive("name of stacklayoutbean");

//Next add the button to existing stacklayout which contains all existing buttons
oslb.addIndexedChild(newButtonbeanHere)

In real world though, container for buttons may or may not be stack layout
Thanks,
Anil Passi
Problemin Account values loading
written by manikandan , January 24, 2008
Dear Anil,
I am trying to convert the account values from legacy to oracle base tables(fnd_flex_values,fnd_flex_values_tl).The problem is we could not load the segment qualifiers from the legacy table to base table.It is not displaying in front end.We are using R12.Please solve my problem.
...
written by Luckoteea , January 25, 2008
Hi Anil,
I am looking for Oracle Application documentation in French, can you help out, where I can get these documents, like user manuals, setup manuals, etc...
Thanks
rajiv
Nice one Anil
written by Tapash Ray , February 14, 2008
Just wanted to add the reason why SubmitButton cannot be added via personalization.
Think of it this way, even if we were able to add a submit button, what would we be able to achieve ?
Since we would want to call a piece of logic when the form is submitted using the SubmitButton, we would anyway need to customize the controller, and since we are customizing the controller, we can create the button there itself.

Tapash
...
written by Anil Passi , February 14, 2008
Hey Tapash

As always, you are spot on.

Cheers
Anil Passi
Is it Possible to handle the Submit Buttom through Enter Key (Key Board)
written by Zafar Sadiq , March 07, 2008
Hi Anil ,
Is it possible to handle Key Board ENTER key through code . For example : if user press Enter key i want certain events to be handled or navigate to other page

Thanks

You must be logged in to a comment. Please register if you do not have an account yet.

busy