If it works with a Text field then it should work with Select lists also. The only major difference is that Select lists work with a display and return value. Are you sure you set the return value and not display value?
I do not refer to the return or display value explicitly. However inspired by your answer I begun to test a bit more, and completely by accident I found something that works. It's not an optimal way though, but maybe this will give you any hint for a more neat way.
Ok, I have two items, lets say 1st_name_list and 2nd_occupation_item.
When the 2nd_occupation_item is a text filed, then I have a dynamic action attached to the 1st_name_list item (on change). It consists of two true actions:
1. Set value, SQL Statement type
"select default_occupation from my_table
where name = :1st_name_list"
2. Refresh: refresh 2nd_occupation_item
The default value of 2nd_occupation_item is left blank (static text type). Everything works fine.
When I change the 2nd_occupation_item into the select list there's no refresh. Or the refresh happens (you can see select list reloading), but the value remains unchanged.
The detour is to add the default value as PL/SQL Expression for 2nd_occupation_item, in the way:
"case when :2nd_occupation_item = 'John' then 'Doctor'
when :2nd_occupation_item = 'tom' then 'Janitor'
else 'Fireman' end"
Now the refresh works. The problem is that writing the whole case clause is not as convinient as using the select statement, especially with many default categories.
What's more, I cannot remove the set value action. Without it the refresh will not work.
Do you have any ideas?
What I meant with display and return value, you usually have a Select list query like this:
SELECT occupation d, occp_id r
So your return value is an ID. To use text as a return value is rather uncommon. Hence my question, because obviously you need to Select the return value in your query, NOT the display value.
At that time your select list still has the OLD value in the session. You then do a refresh and the item uses the old value, and it looks like nothing happens.
- clear the default values, you don't need those
- get rid of the refresh in your DA
I know it's uncommon, and in most cases in my application the return value is numeric (ID). But in this case the display and return values are the same.
The select statement is the same for the text field and the select list.
In the case of text field it works without the default values, refresh is needed though. (by it I mean that the change in the first select list results in a change in the other item - in this case the text field).
With select list it does not work without the default values, which I cannot grasp.
Did you implemented my solution?
Yes, but with no refresh action id DA, the second item is not refreshed. Or did I misunderstand something?
It doesn't have to be refreshed. Refresh only gets the most recent session value, and you have not updated that yet with your code.
Can you create an example on apex.oracle.com so I can have a closer look?
I've requested the workspace, prepared an example... and it worked the way you sai!d I just didn't include the refresh action.
After careful examination of the previously described case it began to work as well. Unfortunately I'm unable to finde the very first mistake that I had made (after so many corrections it's impossible), but you showed me the right direction Many thanks