user679526
user679526

Reputation: 845

Submit data in one form from another form JSF

When edit is selected, the backing bean is called but the form fields are not pre filled with the data.

<h:form id="EmpDetails">
   <h:inputText value="#{empBean.fName}">
      <f:validateBean disabled="#{param[skipBeanValidation]}"/>
    </h:inputText>

<h:dataTable> 
 <h:column>
    [<h:commandLink value="Edit" immediate="true">
      <f:ajax execute="@form" render="@form" listener="#{empBean.edit}"/>
     </h:commandLink>  ]
     Changed to 
     <h:commandLink value="Edit" action="#{empBean.edit}">
       <f:param name="skipValidation" value="true"/>
     </h:comamndLink>
  </h:column>     
 </h:dataTable>

<h:commandLink value="#{empBean.addEmployee}"/>
<h:commandLink value="#{empBean.continue}"/>
</h:form>

Upvotes: 2

Views: 1998

Answers (1)

BalusC
BalusC

Reputation: 1108722

This isn't how HTML forms are supposed to work. A single HTML form should surround all input elements and buttons which all participate in the same form.

Put the related form elements together in the same form. If you encounter a problem with it, then it has to be solved differently. For example, by using partial submits in ajax.

Upvotes: 3

Related Questions