I have a .xhtml file with p:selectOneMenu
and p:outputLabel
inside. p:selectOneMenu
is populated from the bean with f:selectItems
. In the bean it is a List<SelectItem>
where SelectItems have value, label and description.
My goal is to show description of the selected item in the p:outputLabel
without making an ajax call to the bean. I can only find values in the DOM tree. I believe it is stored somewhere and I can access it with JS or use some JSF tools.
Asked
Active
Viewed 199 times
0
-
So your basic question is like formulated here: http://stackoverflow.com/questions/10891586/get-selected-value-from-selectonemenu-using-javascript-in-primefaces-and-open-a . I used google with these terms to find this 'duplicate' : ["stackoverflow get selected value of selectonemenu primefaces javascript"](https://www.google.nl/search?q=stackoverflow+get+selected+value+of+selectonemenu+primefaces+javascript) – Kukeltje Jun 30 '15 at 13:13
-
Yes, but I want to get a description. The problem is that my HTML ouput has a ` – Chechulin Jun 30 '15 at 13:19
-
description == label from what I know... If you think differently, create an mcve – Kukeltje Jun 30 '15 at 13:45
1 Answers
0
in the method where this list there can declare a String variable that you capture the selected data and then can call on the label of XHTML

Alexander Villalobos
- 461
- 3
- 11
-
-
I think if you need the ajax when value change is simply a change event , but you can try – Alexander Villalobos Jun 30 '15 at 13:32