Hello Everybody, I have a table called " QuestionReponse " and another one called "Non Confirmite ". The " Non Conformite " table has a foreign key to the " QuestionReponse " table, and after generating entities I get an object of Questionreponse in the "NonConformite" entity. The "NonConformite" entity contains just two attributs, the ID (generated automatically) and the Questionreponse Object
There is the code I'm using now:
Code:
<h:form>
<rich:dataTable value="#{questionreponseList.resultList}" var="_qr" rows="10">
<rich:column>
<h:outputText value="#{_qr.idquestionReponse}" />
</rich:column>
<rich:column>
<rich:inplaceInput value="#{_qr.commentaire}" />
</rich:column>
<rich:column>
<h:selectOneMenu value="#{_qr.reponse}" id="selectedReponse"
style=" width : 303px;">
<f:selectItem itemLabel="#{questionreponseHome.instance.reponse.reponse}"
itemValue="" />
<s:selectItems value="#{reponseAction.initReponseToTrack()}"
var="_reponse" label="#{_reponse.reponse}" />
<s:convertEntity />
<a:support event="onchange" action="#{reponseAction.test()}" />
</h:selectOneMenu>
</rich:column>
<rich:column>
<h:commandButton value="Create Non Conformite"/>
</rich:column>
<f:facet name="footer">
<rich:datascroller maxPages="5" />
</f:facet>
</rich:dataTable>
<h:commandButton action="#{nonconformiteAction.initNonConformite()}" value="Save"/>
</h:form>
I want that when I click on the "Create Non Conformite" an object of Nonconformite will be created containing the Questionreponse on the same row and put it in the database.
Any idea how can I do that?
I hope my post is clear, please help me.