I have the follow modal form in Bootstrap, where the user insert data for add a new line but the p:commandbutton never executes lineaBean.insertar() and I don't know what it's doing this when I have a delete modal form that looks equal and works like a charm... any ideas? Here is my code:
<!-- Bootstrap trigger to open modal -->
<div class="hide fade modal" id="insertar-linea">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>Alta de linea</h3>
</div>
<h:form class="form-horizontal well" id="form-insertar-linea">
<div class="modal-body">
<fieldset>
<h4>Número: </h4><h:inputText id="numero-form" class="validate[required]" value="#{lineasBean.numero}"></h:inputText>
<h4>Fecha Validacion: </h4><h:inputText id="fecha-form" class="validate[required]" value="#{lineasBean.fechaFact}"></h:inputText>
<h4>Publico: </h4>
<h:selectOneRadio id="publico-form" value="#{lineasBean.publico}">
<f:selectItem itemLabel="SI" itemValue="y"/>
<f:selectItem itemLabel="NO" itemValue="n"/>
</h:selectOneRadio>
</fieldset>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancelar</a>
<p:commandButton id="okInsertar" onclick="if($('#form-insertar-linea').validationEngine('validate')===false){return false;}"
styleClass="btn btn-primary ok" value="Ok" action="#{lineasBean.insertar()}"
oncomplete="checkCRUD(xhr, status, args)"/>
</div>
</h:form>
</div>
最终,我找到了解决方案,当我传递一个字符串时,我在我的bean上将'fechaFact'设置为Date类型...因此我创建了SimpleDateFormat以通过Managed Bean的方法将字符串解析为Date。
Sounds similar to Unable to execute Backing bean method with the answer "When i made it Session scoped its working Fine." Does this work for you, too?
尝试在按下p:command按钮时使用actionListener而不是action来调用方法
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.