I'm trying to reset some input text fields, inside of a data table, using a cancel button. The issue I'm having is that, if I attempt to cancel it, but there are validation errors, it does not allow me to do so because it does validation first, finds and error, and outputs the error before it can rerender itself.
The obvious solution is to set "immediate=true" on the button. This gets rid of the issue and allows me to cancel without validation BUT the fields themselves are not set to their original values. This is because the components themselves never reget the data from the backing beans BECAUSE of immediate is set to true.
This is very well explained in this article: http://wiki.apache.org/myfaces/ClearInputComponents
The article presents many solutions, but none of them work for me.
- I have to stay on the same page, so changing views is not an option.
- I can't reset the values of ALL input fields on the page because I only want the 'row' that I cancel to be reset
I can't seem to bind components to any of the input fields because, since they are in a datable, the "binding" attribute of the input field itself cannot reference a 'var' variable. For example, the following "binding" attribute is illegal and gives me an error:
<ice:dataTable id="poolSharesTbl" var="node" value="#{poolSharesManager.nodeModel}" ... <ice:column> <ice:inputText binding="#{node.inputTextBinding}" ...
This may have to do with 'var' only being request-scope.
Anyway, does anyone have any ideas on how to get this working?