jsf-PrimeFaces如何关闭模态表单
jsf PrimeFaces how to close modal form
我创建了一个模态表单。而提交按钮工作正常:
<p:commandButton ajax="false" value="save" action="#{editErReferencesFormWebBean.submit}" />
我不知道如何创建一个只关闭对话框的取消按钮。我不想为此打电话给服务器。有没有一种简单的方法可以关闭对话框(并放弃所有输入)?
阅读Primefaces文档:
<p:dialog widgetVar="modal" modal="true" closable="false">
<!-- Modal content -->
<h:form id="form">
<p:commandButton value="Cancel" onclick="PF('modal').hide();$('#form').trigger('reset');" type="button" />
</h:form>
</p:dialog>
此外,您可以将closable
属性设置为true
,以显示关闭对话框的X
图标。
试试这个:
<h:form id="form">
<h:panelGrid columns="1" cellpadding="5">
<p:commandButton value="Modal" type="button" onclick="PF('dlg').show();" />
</h:panelGrid>
<p:dialog header="Modal Dialog" id="myDialog" widgetVar="dlg" modal="true" height="100">
<h:outputText value="This is a Modal Dialog." />
<p:inputText/>
<button id="myButton" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" onclick="$('#form'':myDialog').hide(); $('#form'':myDialog_modal').remove();$('#form').trigger('reset');">
<span class="ui-button-text ui-c">
My Button
</span>
</button>
</p:dialog>
</h:form>
谨致问候。
相关文章:
- 包括来自另一个页面的Boostrap模态;t验证表单
- 数据表和模态
- 在表单提交后显示模态,直到加载下一页为止..不适用于狩猎
- 将隐藏输入类型转移到我的隐藏模态/表单
- 如何在单击表行时显示模态
- 获取表单值并在提交时将其传递给Bootstrap模态
- 使用 JavaScript 将数据链接从模态发送到表单
- JavaScript 使模态在 Rails 中提交表单
- jQuery 模态表单保存到 JavaScript 数组
- 使用模态弹出联系表单,是否可以在提交时在同一弹出窗口中显示确认
- 在模态中使用 jquery 验证器后,从表单中重置/删除类
- 打开模态时,我需要使用什么来提交表单
- AngularJS 模态对话框表单对象在控制器中未定义
- 使用 jquery ajax 从 Bootstrap 3 模态表单获取数据
- 如何使用 Reactjs 用组件的状态填充模态表单
- React-Bootstrap 模态表单条目
- 如何在表单提交后使用 JavaScript 打开模态
- Angularjs UI 模态表单
- Jquery-UI 模态表单无法正常工作
- 如何从模态提交引导表单