Reputation: 767
I have resolved my previous problem posted in:
Now I would like to know how to get the values modified in the form and pass to my bean.
This is how I done:
in the form:
<ui:repeat value="#{myBean.myList}" var="item">
<td class="icePnlGrdCol1" id="nacionI-0-#{item.index-1}">
<input class="iceInpTxt celdaNacionI"
id="I#{item.index gt 9 ? '':0}#{item.index}"
name="I#{item.index gt 9 ? '':0}#{item.index}"
title="I#{item.index gt 9 ? '':0}#{item.index}" type="text"
value="#{item.valor}" />
</td>
</ui:repeat>
in the bean:
private List iniciosMesList = null;
CeldaGrid is a class with their getter/setter
I want the get the value of every inputText in the form an re-create the list before to pass to my database.
How can I access this values???
thanks
Upvotes: 0
Views: 1415
Reputation: 38163
Use an <h:input>
instead of <input
>. Provide a valueChangeListener attribute that binds to your backing bean. For each value in the list that the user has changed, this listener will be called. You can additionally provide or grab the item
iteration variable with this call back.
This way you can construct a list of all items that have changed, and send these to your DB. Or, if merge them with your original list and send that to the DB.
(p.s. I advice you not to use a raw List as in private List iniciosMesList = null;
, but parameterize it correctly)
Upvotes: 1