primefaces - Can't reset input Field JSF -


this question has answer here:

i'm trying rest inputvalues jsf prime faces:

i have inputfields , select menus, menus working ok after hit save button, input values not cleared

i don't wanna use spearat button, want make automatic after hit save reset input fields:

html code :

    </h:form>                                <center>             <h:form id="form" style="width: 600px; text-align: center;">              <p:panel id="panel" header="اضافه طالب غائب">                 <p:growl id="msgs" showdetail="true" />                     <p:panelgrid columns="2">                          <h:outputlabel value="رقم المعلم:" />                         <p:inputtext label="رقم المعلم" required="true"                         requiredmessage="contact number required!"                         style="width: 150px; text-align: center;"                         value="#{pprbean.teacherid}"/>                                        <h:outputlabel  value="اختر الفصل" />  <p:selectonemenu id="city20" value="#{pprbean.classname}" style="text-align:center;">                  <f:selectitem itemlabel="اختر الفصل" itemvalue="" style="text-align:center;" />                   <f:selectitems value="#{pprbean.clasess}" style="text-align:center;" />                      <p:ajax update="city21"                           listener="#{pprbean.handleclassnamechange}" />              </p:selectonemenu>                                     <h:outputlabel  value="اختر الطالب" />                                     <p:selectonemenu id="city21" value="#{pprbean.names}" style="width:140px; text-align:center;">                  <f:selectitem itemlabel="اسم الطالب" itemvalue="" style="text-align:center;" />                   <f:selectitems value="#{pprbean.studentnames}" style="text-align:center;" />                      <p:ajax update="" listener="#{pprbean.handlenameschange}" />               </p:selectonemenu>                                <h:outputtext value="الفتره من " />                             <p:calendar value="#{pprbean.from}" showbuttonpanel="true"                                 pattern="yyyy-mm-dd"                                  style="width: 200px; text-align: center;" />  <h:outputlabel  value="الحصة" /> <p:selectonemenu id="city1" value="#{pprbean.interval}" style="width:140px; text-align:center;">                   <f:selectitem itemlabel="اختر الحصة" itemvalue="" style="width:140px; text-align:center;" />                   <f:selectitems value="#{pprbean.intervals}" style="width:140px; text-align:center;" />                      <p:ajax update=""                           listener="#{pprbean.handleintervalchange}" />               </p:selectonemenu>     <h:outputlabel value="الحالة" /> <p:selectonemenu id="city3" value="#{pprbean.appsent}" style="text-align:left;">                   <f:selectitem itemlabel="حالة لغياب" itemvalue="" style="text-align:left;"/>                   <f:selectitems value="#{pprbean.apssents}" style="text-align:left;" />                      <p:ajax update=""                           listener="#{pprbean.handleappsentchange}" />               </p:selectonemenu>                       </p:panelgrid>                     </p:panel>                     <p:commandbutton action="#{pprbean.insert}"                             value="ادخال" update="form"/>               </h:form>          <p:ajaxstatus style="width:64px;height:64px;position:fixed;right:5px;bottom:5px">       <f:facet name="start">           <p:graphicimage value="/css/loading.gif" />       </f:facet>        <f:facet name="complete" process="@this" type="org.primefaces.examples.view.cleanlocalvalueslistener">           <h:outputtext value="" />       </f:facet>   </p:ajaxstatus>             </center>             <br />               <br />           </ui:define>     </ui:composition> </h:body>  

code :

    public void reset() {       requestcontext.getcurrentinstance().reset("form:panel");      teacherid=null;     classname=null;     interval=null;     studentcode=null;     names=null;     from=null; }  

try using resetinput component:

http://www.primefaces.org/showcase/ui/misc/resetinput.xhtml


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -