While using selectOneChoice in the page to implement drop downs, it becomes very cumbersome to get the selected value from the list. One often has to write some lines of code in the managed bean to get the selected value from the drop down.
So in this post we will see how to get the selected value from the drop down list (af:seclectOneChoice) without writing a single line of code and without using any bean.
This uses the use of Variable Iterator which we discussed in the previous post.Variable Iterator in ADF to store values between requests
The application can be downloaded from Here
So lets get started and create a ADF application in jdev with a jspx page named test.jspx as below.
Now go to bindings of this page and inside variables , add a new variable of type string and give it a name. regionName for this example.
Now in bindings section create a new list binfing.
So in this post we will see how to get the selected value from the drop down list (af:seclectOneChoice) without writing a single line of code and without using any bean.
This uses the use of Variable Iterator which we discussed in the previous post.Variable Iterator in ADF to store values between requests
The application can be downloaded from Here
So lets get started and create a ADF application in jdev with a jspx page named test.jspx as below.
Now go to bindings of this page and inside variables , add a new variable of type string and give it a name. regionName for this example.
Now in bindings section create a new list binfing.
Select the following option
Now select the base data source as variables. Select list data source as the RegionsVO. Data Mapping section tells that the variable regionName is being mapped to the regionName from the list. Set the settings like below.
Now create a attributeValues for the variable inside Variables Iterator like below.
We are done with the bindings part.
Now lets create two UI components on the test page. selectOneChoice and input text like below.
Set the input value for the selectOneChoice from the el and make it refer to the list binding variable regionName1.
And select the value of inputTest as input value for attributeValues binding regionName2 which refers to the variable.
Below is the source code of the page. Autosubmit and partial triggers have been set.
That's it. Lets run the pages.
Now select value from the drop down.
And you can see the value in inputText as same as selected value from the list.
So we achieved to retrieve the selected value from the list without writing of the single line of code.
Happy Learning !!
thanks a lot for Anna University Results Nov Dec 2013 Exam Results UG PG Results 2014 For 1st 3rd 5th 7th Semester Updates
ReplyDeleteHi Rohan, thanks a lot for this post, I have learnt a new concept of what variable iterating can do. I was trying using the selected value say, Americans, this value I am trying to use in setCurrentRowWithKeyValue to navigate to the corressponding row in the next page, but does not work. Could you please help.
ReplyDeleteThank you a lot .. great job man the real solve to SOC problem
ReplyDeleteHi Rohan,
ReplyDeleteVery Nice post.
I have a requirement where in a page there are two regions. If we select(select one choice) department id in 1st region then all the employees of that department id should be displayed in region 2. can you suggest solution for this scenario.
I followed your post for getting selected value from select one choice.
But what steps do i need to implement for achieving my requirement.
Thanks a lot for sharing useful tutorial.
ReplyDeleteoppo f19
ReplyDelete