March 02, 2016

How to partial reset form in primefaces


To reset input fields of a part or a component of a form programmatically , we need to use reset method similarly like we do update through managed bean.
for example I have below code snippet :

1:  <p:panel id="panel">  
2:       <p:inputText id="text1">   
3:       <p:inputText id="text2">   
4:       ...  
5:       <P:commandButton .. />  
6:  </p:panel>  

and need to reset the component ("panel") then using below code in managed bean I can reset all input fields/components under it:

 RequestContext.getCurrentInstance().reset("form:panel");  

It will reset only the component which is provided in rest method.

No comments:

Post a Comment