重置素数中的输入字段 [英] Reset input fields in primefaces

查看:41
本文介绍了重置素数中的输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个对话框来输入详细信息.第一次,InputText 是空的.但是从第二个输入开始,InputText 保持之前的值.

I have a Dialog to input details. At the first time , InputText are empty. But from the second input, InputText maintain the previous value.

这是我的代码:

     <p:commandButton id="showDialogButton1" type="button" value="add" onclick="dlg1.show()" update="firstname1"/>
     <p:dialog id="dialogAjout" header="add department" widgetVar="dlg1" resizable="false">  
          <h:panelGrid columns="2" style="margin-bottom:10px">  
                <h:outputLabel for="firstname1" value="Libellé :" />  
                <p:inputText id="firstname1" value="#{departementBean.departement.libelleDepartement}" />
          </h:panelGrid>  
          <p:commandButton id="submitButton1" value="Valider" oncomplete="dlg1.hide();" action="#{departementBean.addDept()}" update="tabView"/> 
     </p:dialog>

我该如何解决这个问题,请!!

How can I resolve this, please !!

推荐答案

您可以使用这个 primefaces 组件:http://www.primefaces.org/showcase/ui/misc/resetInput.html关于一般对话框:不要将它们放在表单中.改为:...关于 update="" 值,如果您的 appendToBody 为 true,请在 id 前面放一个冒号(这意味着它是另一种形式).

You can use this primefaces component: http://www.primefaces.org/showcase/ui/misc/resetInput.xhtml Regarding dialogs in general: don't put them inside forms. Have this instead: <p:dialog><h:form>... Regarding update="" values, if your appendToBody is true, put a colon in front of the id (that means it`s in another form).

这篇关于重置素数中的输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆