Wednesday, February 24, 2010

Adding button side to text field for oracle apex

This is with related to a trick in Oracle apex3.1.
Requirement:
If you want to add a button near by(Exactly at the right hand side of a text field) a text field in a form that will open a pop up window.
Soultion:
First create a display only text item.
In the post element text attribute of the display only text item add the following text


<button onmouseover="this.style.cursor='hand'" style="cellpadding: 16;" type="button">
onClick="javascript:callToOpenPopup('&APP_ID.','&APP_SESSION.','','','','','','','680','320');">




In the HTML header of your apex page add these java script function
function


callToOpenPopup(pAPP_ID,pAPP_SESSION,pPageNo,pKeyColumn,pKeyValue,pIRReportID,pModeColumn,pMode,pWidth,pHeight)
{
var url;
if (pKeyValue > 0) {url = 'f?p='+pAPP_ID+':'+pPageNo+':'+pAPP_SESSION+'::::'+pKeyColumn+','+pIRReportID+','+pModeColumn+':'+pKeyValue+','+$v('apexir_REPORT_ID')+','+pMode;}
else {url = 'f?p='+pAPP_ID+':'+pPageNo+':'+pAPP_SESSION+'::::'+pModeColumn+':'+pMode;}
var w = open(url,"winLov","Scrollbars=1,resizable=1,width="+pWidth+",height="+pHeight+", noresize modal=yes");
w.moveTo(500,100);
if (w.opener == null)
w.opener = self;
w.focus();
}

In the edit region page make both the text field and the newly created display only text as a single item.

No comments:
Write comments