Home » Developer & Programmer » Application Express & MOD_PLSQL » display field
display field [message #432419] Tue, 24 November 2009 02:09 Go to next message
salwa
Messages: 76
Registered: December 2007
Member
how to retrive name,adress etc display field aganist code
such as from builder
next_key_item trigger
select dept_name,address,phone into :x,:y,:z from dept
where dept_no=:dept_no

please help

[EDITED by LF: applied [code] tags]

[Updated on: Tue, 24 November 2009 03:21] by Moderator

Report message to a moderator

Re: display field [message #432535 is a reply to message #432419] Tue, 24 November 2009 19:36 Go to previous messageGo to next message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

Dear Salwa,

Attached (AutoValuePopulateOnChange.pdf)is your solution.
i have used EMP & DEPT table for example.

Note: Attached doc will guide you to do so.

Try it.



Thanks

--Kamal Hossain

[Updated on: Tue, 24 November 2009 19:41]

Report message to a moderator

Re: display field [message #433235 is a reply to message #432535] Mon, 30 November 2009 20:20 Go to previous messageGo to next message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

More update on Dispaly Field:

If we want to populate multiple display field on change of a specific field (ex. if deptno change then dname,loc,count emp will show in the respective display field.) then follow the below steps:

Step : 1
Take 4 Text field in your page:
 
 P53_DEPTNO,P53_DNAME,P53_LOC,P53_COUNT


Step : 2
crete an application process named :multipleAjax
Set process point On Demand : Run this application process when requested by a page process


Step : 3
Type the process text as :

declare
      v_deptno number(10);
      v_dname varchar2(100);
      v_loc varchar2(100);
      v_count number(10):=0;
begin
    v_deptno:=wwv_flow.g_x01;

    SELECT DNAME,LOC INTO v_dname,v_loc 
    FROM DEPT WHERE DEPTNO=v_deptno;
  
    SELECT COUNT(*) INTO v_count from EMP
    WHERE DEPTNO=v_deptno;


  apex_util.set_session_state('P53_DNAME',v_dname); 
  apex_util.set_session_state('P53_LOC',v_loc); 
  apex_util.set_session_state('P53_COUNT',v_count); 
  apex_util.json_from_items('P53_DNAME:P53_LOC:P53_COUNT');
EXCEPTION
  WHEN NO_DATA_FOUND THEN
  NULL;
end;


Step : 4
go to HTML header of your page and type the below javascript code:
<script type="text/javascript">
<!--
function disFormItems()
{
    $x_disableItem('P53_DNAME',true);
    $x_Style('P53_DNAME','background','yellow');
    $x_disableItem('P53_LOC',true);
    $x_Style('P53_LOC','background','yellow');
    $x_disableItem('P53_COUNT',true);
    $x_Style('P53_COUNT','background','yellow');



}

function f_dinfo(pValue)
{ 
     $x(document.getElementById('P53_LOC')).value='';
     $x(document.getElementById('P53_COUNT')).value='';
     $x(document.getElementById('P53_DNAME')).value='';

     var getData = new apex.ajax.ondemand('multipleAjax',
     function()
		   {
						
                        var rState = p.readyState;
			if(rState == 4)
			{ 
			  gReturn = p.responseText;
			  (gReturn)?json_SetItems(gReturn):null;
			}
			else if (rState==1||rState==2||rState==3)
                         {
                         }
                        else
			{
			return false;
			}
			}
                        );
  getData.ajax.addParam('x01',(!!pValue)?pValue:$v('P53_DEPTNO'));
  getData._get();
}
//-->
</script>


Step : 5
go to the properties of "P53_DEPTNO" text field
and type onchange="f_dinfo(this.value)" on
HTML Form Element Attributes

Step : 6
go to HTML body attributes of your page and type below:
onload="disFormItems();"


Step : 7

Now Run your page, change the value of deptno (10,20....) and get desired output.

Thank you
-- M Kamal Hossain
Re: display field [message #596952 is a reply to message #433235] Fri, 27 September 2013 14:56 Go to previous message
lakshman0145
Messages: 12
Registered: May 2013
Location: HYDERABAD
Junior Member
hi,
I have changed code according to my item but in the HTML body attributes
when I give onload= ("disFormItems();") my function name then I am getting
the following error
:You may not declaratively set cursor focus if you specify an ONLOAD in this attribute.
You can programatically set cursor focus by using the following syntax:
onload="mystuff(); first_field();"
pls help me to solve this issue

thanks in advance
Previous Topic: Oracle Apex Versions - 3.2, 4.1 & 4.2 - Oracle Support
Next Topic: Apex
Goto Forum:
  


Current Time: Wed Nov 26 12:45:00 CST 2014

Total time taken to generate the page: 0.11949 seconds