I'm having what must be a simple and common problem, but nothing I've tried has solved it. I want to be able to refresh (reset) the inputText field values in a dataTable.
I have a dataTable that holds required inputText components. I want to have a "cancel" button which would abandon any edits on these components and refresh (reset) them with their backing values, as well as removing the last row from the table (used to enter a new record). Because the inputText components are required, I made the cancel button immediate. I don't know what code I can put in the button's actionListener. Right now, the displayed values survive the round trip to the server and back to the browser, but I want them to be reset to their backing values.
Here is the page, and the backing bean of a test example:
If it makes a difference, my implementation of JSF is MyFaces. Thanks! [ October 26, 2005: Message edited by: Jeff Albrechtsen ]
I think I found a solution to my own problem: add the following to my immediate, command button cancel:
(The ~'s are in there because I can seem to submit a reply with that attribute.) That's the form's javascipt method reset. This seems cheeky to me -- I thought there would be a server-side, JSF solution. Anyone?
Question: UIInput has methods getSubmittedValue and setSubmittedValue, so I can use these to ignore or clear submitted values when I press an immediate command button. This takes care of subclasses like HtmlInputText but not for data tables. Is there a way to manipulate all the submitted values of a data table?