0

I needed to create a datatable with the functionality described here How to dynamically add JSF components

It works, but in my form, besides this datatable I have other elements. I needed that when the add button is clicked, only the data entered in the datatable is submitted besides creating the new field. But the values to contact.email are always null. I'm trying to use primefaces commandbutton.

<h:form>
//other elements
 <h:panelGrid id="region" columns="1">
  <p:commandButton action="#{myBean.addContact}" update="region"  value="add" immediate="true" process="region @this" ajax="true"/>
    <h:dataTable id="addContacts" value="#{myBean.contacts}" var="contact">
    <h:column>
        <p:inputText id="email" value="#{contact.email}" />
    </h:column>
</h:dataTable>
</h:panelGrid>
</h:form>

How can I make this partial submit work?

Thanks

Community
  • 1
  • 1
Kelly Goedert
  • 1,027
  • 2
  • 11
  • 37
  • Sure that your bean is `@ViewScoped`, exactly as shown in the linked answer? If it's `@RequestScoped`, it won't work. – BalusC Nov 09 '11 at 13:33

2 Answers2

-1

use commas to separate the components you want to partially submit

process="@this,addContacts"
Oscar Castiblanco
  • 1,626
  • 14
  • 31
-1

In PrimeFaces try using prependId="false" attribute in the form

<h:form prependId="false">
  • **never** use `prependId="false"`. See https://stackoverflow.com/questions/7415230/uiform-with-prependid-false-breaks-fajax-render – Kukeltje Jun 02 '17 at 12:02