0

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">&times;</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!

solarenqu
  • 804
  • 4
  • 19
  • 44
  • I think this is not exactly the same case, because, my forms not embed each other.. :( – solarenqu Oct 19 '15 at 12:01
  • Then post a MCVE to exclude ambiguity. – BalusC Oct 19 '15 at 12:10
  • i added this line to my post: and they not embed in each other.: – solarenqu Oct 19 '15 at 12:18
  • 1
    It appears that you have no idea what a MCVE is. Here's a link: http://stackoverflow.com/tags/jsf/info. Carefully read particularly the 4th point, including that link. Right now, your problem is not visible in the information provided so far. With a real MCVE, it would be immediately visible to experts. – BalusC Oct 19 '15 at 12:22

0 Answers0