Apps To Fusion

.......Our Journey from Apps To Fusion

 
  • Increase font size
  • Default font size
  • Decrease font size



Sample Code - Add Submit Button Using OA Framework Extension

E-mail
User Rating: / 1
PoorBest 
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 = " This e-mail address is being protected from spambots. You need JavaScript enabled to view it ; This e-mail address is being protected from spambots. You need JavaScript enabled to view it " ;
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 (17)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.
report abuse
vote down
vote up
Votes: +0
...
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
report abuse
vote down
vote up
Votes: +0
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.
report abuse
vote down
vote up
Votes: +1
...
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
report abuse
vote down
vote up
Votes: +0
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
report abuse
vote down
vote up
Votes: +2
...
written by Anil Passi , February 14, 2008
Hey Tapash

As always, you are spot on.

Cheers
Anil Passi
report abuse
vote down
vote up
Votes: +0
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

report abuse
vote down
vote up
Votes: +0
...
written by Kuldeep , September 01, 2008
Hi Anil,
You have done a tremendous job. I learnt a lot from this site.
I want to implement that when any record is deleted say from table a mail is sent to that person. I tried the above written code on this site but not getting the result what i want.

Thanks
Kuldeep Singh
report abuse
vote down
vote up
Votes: +0
...
written by Anil Passi-- , September 01, 2008
Hi Kuldip

First you need to check if there is any business event that fires when record gets deleted.
Next check if there is any custom API Hook which oracle calls
If not, then, you may extend Entity object, and override method deleteRow()
in DeleteRow, you will first call super.deleteRow and then call an email api

Thanks
Anil
report abuse
vote down
vote up
Votes: +0
...
written by Kuldeep , September 02, 2008
Hi Anil,
Actually an event is fired when the record is deleted. In this case what i have to do.
Can u suggest me some code for this.........
report abuse
vote down
vote up
Votes: +0
...
written by Kuldeep , September 02, 2008
Hi Anil,
I got this code..........Is this ok...........

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 = " This e-mail address is being protected from spambots. You need JavaScript enabled to view it '> This e-mail address is being protected from spambots. You need JavaScript enabled to view it his e-mail add***s is being protected from spambots. You need JavaScript enabled to view it ; This e-mail address is being protected from spambots. You need JavaScript enabled to view it '> This e-mail address is being protected from spambots. You need JavaScript enabled to view it his e-mail add***s is being protected from spambots. You need JavaScript enabled to view it " ;
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
}}

Thanks
report abuse
vote down
vote up
Votes: +0
With a little trick ...
written by Ingo , February 09, 2009
it is possible to add a button.

Create a normal button by personalization. Export the personalization.

Replace the button by submitButton and delte unused attributes





import personalization. Bingo


report abuse
vote down
vote up
Votes: -2
Request
written by avb , February 09, 2010
Hi.... I'm new to this ORACLE.
I need assistance from U regarding Checkbox properties.

Actually I can able to display series of checkboxes along with some colomns by using wizard. but the problem for me is that, when I clicked some perticular chekboxes, I want to get corresponding records details only.... but I'm not getting hw to do this. Can U help me ????
report abuse
vote down
vote up
Votes: +1
Procurement Solutions Architect
written by Kalvin , March 30, 2010
I would like to know how to default the value of a checkbox to ticked, so that I can then make it read only. Usually for initial values, you just enter the value it displayes in the fileld, but what is the rule for checked boxes,. e.g In Contracts Provisions - checkbox to show ticked and then read only, so that when attached to a resposnbility it only displays those clauses with provisions.
Thanks
report abuse
vote down
vote up
Votes: +0
...
written by Swadhin Sangram Swain , June 17, 2011
I'm new to OAF. I have added a submit button on Finish Objective Setting page. Now button is there and working but now other buttons are giving error (nullpointer etc) .
report abuse
vote down
vote up
Votes: +0
WebBean Style not supported
written by Hosam , August 02, 2011
Dear
i flow the previous steps to create submit button in extended controller and i got error
WebBean style not supported

report abuse
vote down
vote up
Votes: +1
Adding Submit button dynamically
written by Dominic Ayalogu , December 13, 2011
I typed the following code to create a button dynamically on my page but it didn't create any button as expected

super.processRequest(oapagecontext, oawebbean);
OAWebBeanDateField enddate = (OAWebBeanDateField)oawebbean.findIndexedChildRecursive("HrSitEndDate");
OASubmitButtonBean oasb= (OASubmitButtonBean)oapagecontext.getWebBeanFactory().createWebBean(oapagecontext,"BUTTON_SUBMIT");
oasb.setID("Calc");
oasb.setUINodeName("xxCalculate");
oasb.setEvent("xxCalculate");
oasb.setText("Calculate Days and Amount");
enddate.addIndexedChild(oasb);

Please can somebody explain to me why the code did not create the button as expected

kind Regards

Dominic
report abuse
vote down
vote up
Votes: +0
Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security image
Write the displayed characters


busy
Last Updated ( Sunday, 23 March 2008 15:00 )  

Search apps2fusion