Your render
attribute needs only @form
<r:commandButton action="#searchCriteriaSession.clearSearchCriteria}" value="Reset" render="@form" />
문제
I'm stuck at pretty simple task: I have a search form where the search criteria are stored is SearchCriteriaSession bean, so it could be remembered and pre-filled. And I want to add reset button to that form that would:
1) clear the criteria from bean, therefore call clearSearchCriteria() method of the bean
2) rerender the form, so the fields would be empty
Here's my code and I have no idea why it's not working:
search.xhtml
...
<h:form id="criteriaForm">
<div class="controls">
<h:inputText type="text" id="testName" value="#handlingBean.criteria.testName}" />
</div>
//more input fields but with same format
<div class="form-actions">
<r:commandButton action="#searchCriteriaSession.clearSearchCriteria}" value="Reset" render="@form :criteriaForm" />
</div>
</h:form>
...
The searchCriteriaSession.clearSearchCriteria just clears criteria. When I debug it I see it correctly cleared. Even when I refresh the page the form clears, so the problem is that the render attribute is not working correctly, I guess.
Does anybody can please help me?
P.S.: I'm using RichFaces, this maven artifact:
<dependency>
<groupId>org.richfaces.compat</groupId>
<artifactId>richfaces-components-rich</artifactId>
<version>4.5.0.Alpha2</version>
</dependency>
해결책
Your render
attribute needs only @form
<r:commandButton action="#searchCriteriaSession.clearSearchCriteria}" value="Reset" render="@form" />