Reputation: 6909
I want to generate a select list using an Oracle query but instead of returning html for one select list with multiple options, my query generates multiple select lists with one option in each.
Here is what I want:
<select name="f01" style="width:200px;" id="typename">
<option value="" selected="selected">--Select--</option>
<option value="Apples">Apples</option>
<option value="Oranges">Oranges</option>
</select>
and here is what I am gettting:
<select name="f01" style="width:200px;" id="typename">
<option value="">--Select--</option>
<option value="Apples" selected="selected">Apples</option>
</select>
<select name="f01" style="width:200px;" id="typename">
<option value="">--Select--</option>
<option value="Oranges" selected="selected">Oranges</option>
</select>
Here is my query:
select APEX_ITEM.SELECT_LIST
(p_idx => 1
,p_value => TYPE_NAME
,p_attributes => 'style="width:200px;"'
,p_show_null => 'YES'
,p_null_value => NULL
,p_null_text => '--Select--'
,p_item_id => 'typename'
) "TYPE_NAME"
FROM ALL_TYPES;
What am I missing?
Upvotes: 1
Views: 3085
Reputation: 416
You're creating select for each row of your query.
Consider following:
select APEX_ITEM.SELECT_LIST_FROM_QUERY(
p_idx => 1,
p_query => 'SELECT TYPE_NAME from ALL_TYPES',
p_attributes => 'style="width:200px;"',
p_show_null => 'YES',
p_null_text => '--Select--',
p_item_id => 'typename')
from dual;
Upvotes: 3