Home » Fusion Middleware & Colab Suite » WebCenter Suite & Portal » Oracle portal and PL/SQL (Oracle 10g)
Oracle portal and PL/SQL [message #299940] Wed, 13 February 2008 16:17 Go to next message
shahiajf
Messages: 5
Registered: January 2008
Junior Member
Hi,

I was trying to create a report based on the values selected in two drop down lists in Oracle portal. I was successful in creating two drop down boxes using the following code

begin
  htp.p( 'Select a Customer:' );
  htp.formSelectOpen( 'p_customer');

  for c in ( select distinct des1,customer_no
             from ar_customer_master)   loop
htp.formSelectOption( c.des1,c.customer_no, 
           cattributes => 'value = || c.customer_no|| ' ); 
  end loop;

 htp.formSelectClose;

htp.br;
HTP.BR;
  htp.p( 'Select a group:' );
htp.formSelectOpen( 'p_customer');
 
  for c in ( select distinct addrgrprpt,customer_no
             from custudyref where customer_no = '1006')   loop
htp.formSelectOption( c.addrgrprpt,c.customer_no, 
           cattributes => ' || c.addrgrprpt|| ' );     
  end loop;
 

  htp.formSelectClose;

  
end;


I am having problem with filtering the second drop down. I will need to populate the second drop down list based on the value selected in the first. I don't know how to do it. In the code I have hard coded customer_no = '1006', instead I need dynamic value the user select in the first one.

Can anyone help me to retrieve the value of the item selected in the first drop down and assign to a variable?

Thanks

[mod-edit: Frank replaced <ORACLE> tags with proper [code] tags]

[Updated on: Thu, 14 February 2008 00:56] by Moderator

Report message to a moderator

Re: Oracle portal and PL/SQL [message #300022 is a reply to message #299940] Thu, 14 February 2008 00:58 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
If you want to execute a query, based on the selection in the first page, you will have to get back to the server after selecting a value in the first dropdown.
(This can be done by using Ajax)
Another option would be to prepare a javascript array of possible value-combinations for first and second dropdown and use javascript to change the contents of the second dropdown, based on that array plus the selected value in dropdown 1
Re: Oracle portal and PL/SQL [message #300176 is a reply to message #299940] Thu, 14 February 2008 08:49 Go to previous messageGo to next message
shahiajf
Messages: 5
Registered: January 2008
Junior Member
Can you help me using Ajax? I am a newbie in Oracle portal. Do you know how to get the value from the drop down when user make a selection? I know "onchange"event would work. I don't know how to put it inside oracle tag. I tried like this

htp.formSelectOpen( 'p_custno',
cattributes => 'onChange = lookUp( this.options[' ||
'this.selectedIndex].value );' );

where 'lookup' is a function in Javascript.

<script language="javascript">
function lookUp( customer_no)
{
document.forms[0].p_custno.value = customer_no;
document.forms[0].submit();
}
</script>

Thanks for your help
Re: Oracle portal and PL/SQL [message #300242 is a reply to message #299940] Thu, 14 February 2008 12:24 Go to previous message
shahiajf
Messages: 5
Registered: January 2008
Junior Member
Do you mind checking my code and see if there is anything wrong in the code?. The filtering part still does not work. Is there any way I can debug this code?

begin

htp.p( 'Select a Customer:' );
htp.formSelectOpen( 'p_customer');

for c in ( select distinct des1,customer_no
from ar_customer_master) loop
htp.formSelectOption( c.des1,c.customer_no,
cattributes => 'value = || c.customer_no|| ' );
end loop;
htp.formSelectOpen( 'p_custno',
cattributes => 'onChange="lookUp( this.options[' ||'this.selectedIndex].value );"' );

htp.p('<script language="JavaScript">');
htp.p('function lookUp( customer_no){');
htp.p('customer)no');
htp.p(' document.forms[0].p_custno.value = customer_no;');
htp.p(' document.forms[0].submit();');
htp.p('}');
htp.p('</script> ');


htp.formSelectClose;

htp.br;
HTP.BR;
htp.p( 'Select a group:' );
htp.formSelectOpen( 'p_customer');

for c in ( select distinct addrgrprpt,customer_no
from custudyref where customer_no = '1006') loop
htp.formSelectOption( c.addrgrprpt,c.customer_no,
cattributes => ' || c.addrgrprpt|| ' );
end loop;


htp.formSelectClose;


end;

Thanks
Previous Topic: form submission
Next Topic: error: ADMN-100999
Goto Forum:
  


Current Time: Sat Dec 10 20:51:01 CST 2016

Total time taken to generate the page: 0.07894 seconds