I want to change the selected value of this selectOneMenu
either by managed bean or javascript:
<p:selectOneMenu id="edit-article-famille" widgetVar="editFamille"
required="true" requiredMessage="Veuillez choisir une famille"
value="#{articlesMB.selectedFamille}">
<f:selectItem itemLabel="selectionner famille" itemValue=""/>
<f:selectItems value="#{articlesMB.listFamilles}"/>
</p:selectOneMenu>
How can I do it? In the primefaces user guide, they don't talk about that.
You can set value of your p:selectOneMenu
with widgetVar
in JavaScript:
editFamille.selectValue(value);
value
is value of selectItem
.
Or in more recent versions of PrimeFaces via
PF('editFamille').selectValue(value)