Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

call to htmldb_Get.get() method returning strange results

396749Jun 1 2009 — edited May 25 2010
Hi All,

I have a need for a cascading LOV/Select list in my application. I followed Carl Backstroms example and nothing happened, i.e. the second select list was not populated after a selection in the first.

Using Firebug, i realised the call to get('XML') was returning a null. After several hours of searching for and trying many suggestions, i decided on a whim to replace get('XML') with get(XML) and behold i was able to get a result. get('xml') also returns a non-null result.

After this however, the call to getElementsByTagName("option").length returns an error *'getElementsByTagName is not a function"* and i am now stuck. I have tried everything but to no avail. Is there something i have missed.

Testing my application process code in SQL Workshop produces a select element so i know that part looks fine.

My Code is as below

*Page HTML Header*

<script type="text/javascript">
<!--

htmldb_delete_message='"DELETE_CONFIRM_MSG"';

function getMemberList(src,tgt) {
var l_return = null;
var l_select = $x(tgt);
var l_val = src.value;
var g = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=getm',0);
g.add('TEMPITEM',l_val);
gRet = g.get(XML);
alert(gRet);
if (gRet && l_select) {
var l_cnt = gRet.getElementsByTagName("option").length;
alert(l_cnt);
l_select.length = 0;
for (var i=0; i<l_cnt; i++) {
var l_opt_xml = gRet.getElementsByTagName("option");
appendToSelect(l_select,l_opt_xml.getAttribute('value'),l_opt_xml.firstChild.nodeValue);
}
}
g = null;
}

function appendToSelect(pSelect,pValue,pContent) {
var l_opt = document.createElement("option");
l_opt.value = pValue;
if (document.all) {
pSelect.options.add(l_opt);
l_opt.innerText = pContent;
} else {
l_opt.appendChild(document.createTextNode(pContent));
pSelect.appendChild(l_opt);
}
}

//-->
</script>

*APPLICATION PROCESS*

declare
l_counter number;
l_o_name varchar2(2000);
begin
owa_util.mime_header('text/xml', FALSE );
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
htp.prn('<select>');
htp.prn('<option value="-">-Select Member-</option>');
for rec in (select last_name||' '||first_name as d,
to_char(client_id) as r from client
where group_id = :TEMPITEM) loop
htp.prn('<option value="' || rec.r || '">' || rec.d || '</option>');
end loop;
htp.prn('</select>');
end;

*CALL TO AJAX FUNCTION FROM PAGE ITEM*

onchange="getMemberList(this,'P65_CLIENT_ID');"

When i do an alert(gRet) it displays the ff

Content-type: text/xml; charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache

<option value="-">-Select Member-</option><option value="102">Name1</option><option value="48">Name2</option><option value="4">Name3</option><option value="82">Name4</option></select>

But the line

*var l_cnt = gRet.getElementsByTagName("option").length;*

still produces the error

*gRet.getElementsByTagName is not a function*

All the help i can get is greatly appreciated. Thanks in advance.

Stephen.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2009
Added on Jun 1 2009
21 comments
3,013 views