Hey,
I have a Tabula Form With 2 Select List. Select List A and Select List B. Select List B dopend on Select List A
When i choose a Value On Select List A, i must update List Value on Select List B
List A (A,B,C) LIST B( A,B,C,D)
when List A have Value A Selected than List B must be LIST B (B,C,D)
when List A have Value B Selected than List B must be LIST B (A,C,D)
To make it i have Write a DA on Change
$(this.triggeringElement).closest('tr').find('.LISTB').empty();//I Remove all Elements for the LIST B.
I call the AJAX Call Back SOME_PROCESS and give x01 the value for the Triggerelement
apex.server.process("SOME_PROCESS",
{x01: apex.item(this.triggeringElement).getValue()//Give value for the Träger Element
},
{success: function(pData) {
/* If the AJAX is successful set the value or the returned items */
if (pData.success === true){
/* Loop through the array and set the value of each item */
for (var i=0; i < pData.items.length; i++){
apex.item(pData.items[i].id).setValue(pData.items[i].value);
}
}
},
error: function(request, status, error) {
alert(request.responseText);
}
}
);
That is my AJAX CALL BACK PROCESS SOME_PROCESS to update List B dopend on A
declare
/* Local variables */
v_a varchar2(255);
/* Utility function to output item's id and value */
procedure output_json_item(p_item_name in varchar2,
p_item_value in varchar2
)
as
begin
apex_json.open_object;
apex_json.write('id', p_item_name);
apex_json.write('value', p_item_value, true); /* true so that null values are written as well */
apex_json.close_object;
end output_json_item;
begin
/* ********************** *
* PL/SQL Process Content *
* ********************** */
:P_VALUE:=apex_application.g_x01;
select '<option value="E">E</option>' into v_a from dual;
apex_json.open_object;
apex_json.write('success', true);
apex_json.open_array('items');
/* Call the utility procedure for every item you want to return */
output_json_item('P_VALUE', :P_VALUE);
output_json_item('r', v_a);
output_json_item('d', v_a);
apex_json.close_array;
apex_json.close_object;
exception
when others then
apex_json.open_object;
apex_json.write('success', false);
apex_json.write('message', sqlerrm);
apex_json.close_object;
end;
MY QUESTION ARE: How can i update the LIST B dopend on A. I can only give the Value on the AJAX CALL BACK. I CAN REMOVE THE OPTIONS Value in the LIST B but i can not Set the new
Value depend on LIST A.
Thanks for help
Regards
Pierre