通过f:ajax更新节后,命令按钮不会调用操作

时间:2015-02-24 14:13:24

标签: ajax jsf uirepeat

当我点击<h:commandButton>(没有从<h:selectOneMenu>选择项目)时,我能够调用bean的方法,将我重定向到同一页面以及服务器端验证工作完美。

但是,当我从<h:selectOneMenu>选择项目时,它会通过<h:selectOneMenu>动态呈现输入文本和<f:ajax>组件,然后点击<h:commandButton>,我就会看到<c:forEach>。我无法调用bean方法以及服务器端验证。

我还尝试了<ui:repeat>而不是<h:form id="prodForm" enctype="multipart/form-data" role="form" class="form-horizontal" > <div class="form-group"> Product Name: <input type="text" class="form-control" style="#{component.valid? 'border-color:':'border-color:red;'}" value="#{clientProCtr.cpm.prodName}" id="prod_name" jsfc="h:inputText" required="true" requiredMessage="Product name Required" validatorMessage="Product Name should be between 3 to 50 characters"> <f:validateLength minimum="3" maximum="50"/> </input> <h:messages style="color: red;" class="list-unstyled" for="prod_name" /> </div> <div class="col-lg-6"> <h:selectOneMenu id="select_category" required="true" requiredMessage="Please select a category" value="#{clientProCtr.selectedCat}" > <f:selectItem itemLabel="--Select Category--" noSelectionOption="true" /> <f:selectItems value="#{clientProCtr.clientCat}" var="i" itemValue="#{i.catMasId}" itemLabel="#{i.catName}" /> <f:ajax event="change" execute="@this" render="featureList" listener="#{clientProCtr.displayFeatures()}" /> </h:selectOneMenu> <h:message style="color: red;" class="list-unstyled" for="select_category" /> </div> <h:panelGroup id="featureList"> <ui:repeat value="#{clientProCtr.clientFeatures}" var="j"> <div class="form-group col-lg-6"> <div class="form-group"> <label class="col-lg-4 control-label" for="required">#{j.featureLabel}</label> <div class="col-lg-4"> <input type="text" class="form-control" id="required" alt="textValue" jsfc="h:inputText" /> </div> <div class="col-lg-4"> <h:selectOneMenu class="12"> <f:selectItem itemValue="0" itemLabel="--Select Unit--"></f:selectItem> <f:selectItems value="#{clientProCtr.displayUnits(j.featureMasId)}" var="k" itemValue="#{k.unitFeatureId}" itemLabel="#{k.unitName}"></f:selectItems> </h:selectOneMenu> </div> </div> </div> </ui:repeat> </h:panelGroup> <div class="col-lg-1" style="float: right"> <h:commandButton id="btnAdd" class="btn btn-info nostyle" value="Add" action="#{clientProCtr.addProduct()}" /> <div class="marginB10"></div> </div><!-- End .span4 --> </h:form>

{{1}}

0 个答案:

没有答案