-
1. Re: reset inputText-Values strange..
nimo22 Apr 14, 2009 10:29 AM (in response to nimo22)The reRender is set to myForm (which definitly reRenders the form), but does not reset the inputText-Values:
<h:form id="myForm"> <h:inputText id="myInputText" value="#{myInputValue}" validator=".."/> </h:form>
-
2. Re: reset inputText-Values strange..
sergeysmirnov Apr 14, 2009 11:47 AM (in response to nimo22)This is a expected JSF behaviour. What kind of form you use does not matter.
Read this article about the source of your problem :
http://www.jboss.org/community/docs/DOC-11866 -
3. Re: reset inputText-Values strange..
nimo22 Apr 14, 2009 12:01 PM (in response to nimo22)I found the failure, but I do not know, how to solve it.
The problem is caused by <rich:ajaxValidator event="onblur"/>:
Using this:<h:form id="myForm"> <h:inputText id="myInputText" value="#{myInputValue}" required="true" validator="#{myBean.validateInputText}"> <rich:ajaxValidator event="onblur"/> </h:inputText> <rich:message for="myInputText" /> </h:form>
the reset for "myInputText" does not really work!
When using this (without ajaxValidator):<h:form id="myForm"> <h:inputText id="myInputText" value="#{myInputValue}" required="true" validator="#{myBean.validateInputText}"> <rich:message for="myInputText" /> </h:form>
the reset for "myInputText" does work!
Is that normal? How can I use ajaxValidator and resetForm? -
4. Re: reset inputText-Values strange..
nimo22 Apr 14, 2009 12:17 PM (in response to nimo22)Hello,
I red that http://www.jboss.org/community/docs/DOC-11866.
Indeed, my PhaseListener tells me that there is a (transient) value due to validating via ajax.
Now, I do a normal validation on full form-submit (not ajax-validation) and the reset works. -
5. Re: reset inputText-Values strange..
nimo22 Apr 15, 2009 3:45 AM (in response to nimo22)No it does not work. I use this (as suggested in http://wiki.apache.org/myfaces/ClearInputComponents ) to reset my form:
public void refresh() { FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); ViewHandler viewHandler = application.getViewHandler(); UIViewRoot viewRoot = viewHandler.createView(context, context .getViewRoot().getViewId()); context.setViewRoot(viewRoot); context.renderResponse(); //Optional }
However, I get something like this wyciwyg://6/http://localhost... in the addressbar and nothing works.
When I use a4j:commandButton type="reset", then my inputComponents becomes reset, but then after one second values are inserted what typed before firing the reset button. But my log tells me, that these inputFields are null. Even the action "resetForm" which does explicitly sets the inputFields to null does not help! I cannot use binding and reset the values via binding as I use Seams conversation..is there not a other possibility? -
6. Re: reset inputText-Values strange..
nimo22 Apr 15, 2009 4:57 AM (in response to nimo22)Okay, I have solved that via:
<a4j:commandButton type="reset" immediate="true" action="#{myBean.reset}" value="Reset"> <a4j:support event="onreset" reRender="form"/> </a4j:commandButton>
without using ..findComponent();