Reputation: 6242
I have a selectOneMenu
and an editor
. What I want is to submit the value of the editor
before the value of the selectOneMenu
. The code looks like this
<p:selectOneMenu value="#{myBB.selectedItem}">
<f:selectItems value="#{myBB.selectItems}"/>
<p:ajax event="change" process="itemText @this" update=":mainForm"/>
</p:selectOneMenu>
<p:editor id="itemText" value="#{myBB.selectedItem.text}"/>
It looks like the order of elements in process="itemText @this"
doesn't matter, because when I change it, the values are submitted in unchanged order.
The problem is, that the selectedItem
of the editor is changed by the selection before the value from the editor is submitted.
Am I right, that the order doesn't matter and it is submitted based on the order in the DOM tree? (When I change order of the input fields it's working as I would like to) What is the best way to work around this?
Upvotes: 0
Views: 109
Reputation: 24433
You shouldn't rely on things like layout or processing order in your code. If the problem is that itemText
value is reset when selectedItem
is changed, then bind the text to separate String text
bean variable, and update selectedItem.text
in some other code, maybe <p:ajax listener="#{...}"
.
Upvotes: 2