Hi, normal JSF behaviour (as you already know) is preserving and resdisplaying the invalid input to allow re-type it later, for example: '"12-14-200001" can be understood as date': a user can fix it with minimal effort only by removing two additional zeros.
The classic solution for your problem is [1] tr:resetActionListener or [2] pe:resetEditableValues. Do those two solve your task or is it other problem? > a) How do I get the JSF 1.2 behavior with 2.1? Is resetValue() the wrong method? This is the right method. > b) Ideally I would reset only the executed components instead of all > input fields of the form. How can I determine them? > With richfaces 3.3.3 I checked for request keys representing the > submitted region or the ajaxSingle key. is there anything similar for > ajax commands and JSF 2.1? for example pe:resetEditableValues has attribute 'for' or the standard key javax.faces.partial.execute says it. > c) Shouldn't there be out of the box support for this szenario? Yes, in JSF 2.2 will be such thing as pe:resetEditableValues in core (in prefix f:) [1] http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_resetActionListener.html [2] http://fractalsoft.net/primeext-showcase-mojarra/views/resetEditableValues.jsf Michael Heinen píše v Po 26. 03. 2012 v 15:22 +0200: > So I would like to clear the component values AFTER rendering and BEFORE > state saving. > Is this possible at all? > Or do I have any better alternatives with JSF 2.1? > > Thanks, > Michael > > Am 26.03.2012 13:49, schrieb Michael Heinen: > > Hi all, > > > > I refer to the problem described at: > > https://cwiki.apache.org/confluence/display/MYFACES/Clear+Input+Components# > > > > Workflow: > > 1) Form is submitted > > 2) Validation or conversion fails > > 3) Another command is clicked that loads new or "fresh" data into the > > same area > > Problem: > > The data of request (1) is shown instead of (3) because the submitted > > or local values of the components are not cleared after > > validation/conversion error. > > > > Solution for JSF 1.2 > > I patched com.sun.facelets.FaceletViewHandler and cleared the UIInput > > components via resetValue() before the new state was saved. > > As a result new (fresh) data was shown correctly and the submitted > > value was also shown directly after the validation/conversion error. > > > > With JSF 2.1 this does not work the same way. > > - I patched > > org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView > > - Before accessing the state manager I iterate over the > > clientIdsWithMessages, determine the correspoding form and call > > resetValue for all inputComponents. > > - As a result new (fresh) data is shown correctly after step (3) > > - But the submitted value is NOT shown directly after the > > validation/conversion error (step 2). Instead the original value is > > shown. > > (e.g. User clears required value and submits form, message 'Field > > must not be empty' is shown and field contains the original value > > instead of being empty) > > > > Questions: > > a) How do I get the JSF 1.2 behavior with 2.1? Is resetValue() the > > wrong method? > > b) Ideally I would reset only the executed components instead of all > > input fields of the form. How can I determine them? > > With richfaces 3.3.3 I checked for request keys representing the > > submitted region or the ajaxSingle key. is there anything similar for > > ajax commands and JSF 2.1? > > c) Shouldn't there be out of the box support for this szenario? > > > > Used versions: > > MyFaces 2.1.6 with partial state saving activated > > Tomahawk2 1.1.11 > > Richfaces 4.2.0 Final > > > > Regards, > > Michael >

