Joe
Joe

Reputation: 201

Oracle APEX how do I populate cascading select lists without page submit

I have an APEX page with a few select lists, using collections to save and refresh the page. The "System" select list is dependent upon the "Brand" selected value. I have the page working how I want, but it requires the page to be submitted after a "Brand" value is chosen so that the "System" lov is properly populated.

I am trying to make it so that when the "Brand" value is changed or selected, the "System" lov is changed immediately without needing a page submit. I've been reading and it seems you need to use jQuery and AJAX callback, but I just cannot get my head around that and make any progress.

Hoping someone can help me. I am certainly a rookie with web coding in general.

Added: my local APEX version is 5.0.3.

https://apex.oracle.com/pls/apex/f?p=4550

Workspace: UNCLE_BUCK_WS 
User: developer1 
Pwd: developer1 
Application 83513 - Tooth Selector 
Page 5: Page that works using submit page 
Page 6: Page I started trying to use jQuery, but did not get very far

enter image description here

Added: There is no cascading LOV for manual tabular form. See my region definition below. Hoping someone can still help, maybe copy my page and make the required changes.

select apex_item.select_list_from_query(p_idx => 1,  
                                        p_value => n001,
                                        p_query => 'SELECT tooth_number display_value, tooth_number return_value FROM psp_teeth WHERE tooth_numbering_method = :P5_TOOTH_NUMBER_METHOD
                                                    ORDER BY tooth_number',
                                        p_null_text => '- Choose Tooth -')
       || apex_item.hidden(p_idx => 50, p_value => seq_id) Tooth_Number  
, apex_item.select_list_from_lov(p_idx => 10, p_value => c001, p_lov => 'BRAND', p_null_text => '- Choose Brand -') brand  
, apex_item.select_list_from_lov(p_idx => 12, p_value => c002, p_lov => 'TYPE', p_null_text => '- Choose Type -') type  
, apex_item.select_list (p_idx => 14,  
                         p_value => c003,
                         p_list_values => CASE c001
                                          WHEN 'BRAND_A' THEN 'SYSTEM_A1,SYSTEM_A2'
                                          WHEN 'BRAND_B' THEN 'SYSTEM_B1,SYSTEM_B2'
                                          END,
                         p_show_null => 'YES',                         
                         p_null_text => '- Choose System -') system  
, apex_item.checkbox2(p_idx => 16, p_value => seq_id, p_checked_values => CASE c004 WHEN '1' THEN seq_id END) delete_row
from apex_collections  
where collection_name = 'TEMPCOL'

Upvotes: 2

Views: 6731

Answers (1)

Tony Andrews
Tony Andrews

Reputation: 132580

Don't use tabular forms, they are archaic! Use an Interactive Grid instead, which supports cascading LOVs declaratively (you don't need to write any code, just specify that column TYPE cascades from column BRAND): enter image description here

See page 9 in your app where I have created one (I didn't bother creating the master region). My LOV definition for TYPE is a bit cumbersome, you may be able to improve on that (i.e. get back to the "dynamic static" LOV that you had before).

Upvotes: 1

Related Questions