i have two form on the same jsf 2.2 page and they not embed in each other.:
<f:view>
<h:form id="bizform" enctype="multipart/form-data">
h:panelGrid columns="2">
<h:outputLabel value="Xy: " for="condselect"></h:outputLabel>
<h:outputText styleClass="form-control" id="condselect" value="#{mainViewController.showLocalPackage().name}"></h:outputText>
<h:outputLabel value="something: " for="chargeselect"></h:outputLabel>
<h:selectOneMenu value="#{mainViewController.newChargeTypeId}" styleClass="form-control" id="chargeselect">
<f:selectItems var="charge" itemLabel="#{charge.chargeName}" itemValue="#{charge.id}" value="#{mainViewController.showAllChargeTypes()}"></f:selectItems>
</h:selectOneMenu>
...
...
...
<h:outputLabel value="Upload: " for="bizfile"></h:outputLabel>
<p:fileUpload id="bizfile" value="#{mainViewController.newChargeRegDoc}" mode="simple" auto="false" ></p:fileUpload>
...
...
...
<p:commandButton update=":bizform" ajax="false" actionListener="#{mainViewController.createNewIncomingChargeReg()}" styleClass="btn btn-primary" value="Save"></p:commandButton>
</h:panelGrid>
</h:form>
</f:view>
And here i have a modal dialog, that i can open with a button:
<h:panelGroup id="newchargeBlock" layout="block">
<div class="modal fade bs-example-modal-lg" id="newchargemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
New Charge modal
</div>
<div class="modal-body">
<h:panelGrid columns="4" >
<f:view>
<h:form id="newregtype">
<h:outputLabel for="chargename" value="xy:"></h:outputLabel>
<h:inputText value="#{mainViewController.newChargeTypeName}" id="chargename" styleClass="form-control"></h:inputText>
<h:outputLabel for="chargename" value="xy:"></h:outputLabel>
<h:selectOneMenu value="#{mainViewController.newChargeTypeGroupId}" styleClass="form-control">
<f:selectItems var="item" itemLabel="#{item.groupName}" itemValue="#{item.id}" value="#{mainViewController.showAllChargeGroup()}"></f:selectItems>
</h:selectOneMenu>
<p:commandButton ajax="true" process="newregtype" actionListener="#{mainViewController.createNewIncomingChargeReg()}" value="Save" ></p:commandButton>
</h:form>
</f:view>
</h:panelGrid>
</div>
</div>
</div>
</div>
</h:panelGroup>
If i push the commandbutton in the first form, the backingbean method invoked, and works fine, there is no any error. But if i try to push the commandbuton in the secound form, it's submiting the first form too.
how could i submit only the secound action method?
Thank you very much!