Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » passing oracle variable in javascript
passing oracle variable in javascript [message #496271] Fri, 25 February 2011 11:46 Go to next message
rkhatiwala
Messages: 177
Registered: April 2007
Senior Member
oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
"CORE 11.1.0.6.0 Production"

Hi,
I have an oracle variable l_cnt_result.
and i want to pass this to javascript.. how can I ?

var opt_K_count =  "|| l_cnt_result || " ;
	   
 var opt = select.options[select.options.selectedIndex];
          alert("opt.value = " + opt.value ); 
        alert("opt_K_count  = " + opt_K_count  );


It is printing opt.value, but not opt_K_count...

Thanks.
Re: passing oracle variable in javascript [message #496450 is a reply to message #496271] Mon, 28 February 2011 05:13 Go to previous messageGo to next message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
Is this really related to Application express? If it is then you can create a page item which you set to the value in l_cnt_result and use alert('opt_K_count = ' + document.getElementById('MYPAGEITEM').value) in your javascript.
Re: passing oracle variable in javascript [message #496478 is a reply to message #496450] Mon, 28 February 2011 08:35 Go to previous messageGo to next message
rkhatiwala
Messages: 177
Registered: April 2007
Senior Member
Thank you for the reply..

I am using htp package to create a webpage..

And if I do as you mentioned, can I hide that item.. I had tried doing this:


 -- Get the count for Test Result = 'K'
/*   BEGIN
        SELECT mod(total,10) INTO l_cnt_result 
          FROM WC_TEST_RESULT_CNT_BMW
   	 WHERE module = l_td_rec.part_desc
   	   AND supplier_number = l_claims_rec.supplier_number ;
   EXCEPTION
          WHEN NO_DATA_FOUND THEN
          null;
--   	    htp.bold('Error: Sorry, you do not have permission , please contact the security group for access', cattributes=>'CLASS=error');
         RETURN;
   END;
   */
   l_cnt_result := 99 ;
htp.formhidden('p_cnt_res', l_cnt_result);


I also tried to hard code the value, but its not taking ..

Thank you.
Re: passing oracle variable in javascript [message #496500 is a reply to message #496478] Mon, 28 February 2011 11:07 Go to previous message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
The third parameter to formhidden is any html parameters you wish to supply. So add an id there, and you'll be able to fetch the value in your javascript by using document.getElementById.
Previous Topic: What is Oracle Application Express (Apex)
Next Topic: displaying korean data in html page
Goto Forum:
  


Current Time: Thu Aug 13 19:55:05 CDT 2020