Your example code works fine and the exception you provide makes it
look like you're in a loop?

> Caused by: java.lang.NullPointerException
>        at
> org.apache.tapestry5.corelib.components.Loop.restoreStateFromStoredClientValue(Loop.java:457)

That line from the code:
        // We assume that if an encoder is available when we rendered,
that one will be available
        // when the form is submitted.
        Object restoredValue = encoder.toValue(clientValue);

Makes me think that you aren't getting an encoder?

Can you provide a simple and complete example that breaks?
Josh

On Fri, Oct 2, 2009 at 4:50 PM, xfile80303 <l...@grokers.net> wrote:
>
> Okay, I have some more information...
>
> When I click on the submit button, after the validation error, I see this in
> the log:
>
> ERROR [http-8080-5: RequestExceptionHandler]: Processing of request failed
> with uncaught exception:
> org.apache.tapestry5.runtime.ComponentEventException
> org.apache.tapestry5.runtime.ComponentEventException [at
> classpath:com/java/dse/cwp/eos/pages/Search.tml, line 106]
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1098)
>        at
> org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler.handle(AjaxComponentEventRequestHandler.java:107)
>        at
> $ComponentEventRequestHandler_12417a4b929.handle($ComponentEventRequestHandler_12417a4b929.java)
>        at
> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
>        at
> $ComponentEventRequestHandler_12417a4b92b.handle($ComponentEventRequestHandler_12417a4b92b.java)
>        at
> org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2164)
>        at
> $ComponentEventRequestHandler_12417a4b92b.handle($ComponentEventRequestHandler_12417a4b92b.java)
>        at
> $ComponentEventRequestHandler_12417a4b911.handle($ComponentEventRequestHandler_12417a4b911.java)
>        at
> org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
>        at
> $ComponentRequestHandler_12417a4b80d.handleComponentEvent($ComponentRequestHandler_12417a4b80d.java)
>        at
> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)
>        at $Dispatcher_12417a4b819.dispatch($Dispatcher_12417a4b819.java)
>        at $Dispatcher_12417a4b80a.dispatch($Dispatcher_12417a4b80a.java)
>        at
> org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245)
>        at
> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>        at
> $RequestHandler_12417a4b80b.service($RequestHandler_12417a4b80b.java)
>        at
> org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)
>        at
> $RequestHandler_12417a4b80b.service($RequestHandler_12417a4b80b.java)
>        at
> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)
>        at
> $RequestHandler_12417a4b80b.service($RequestHandler_12417a4b80b.java)
>        at
> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
>        at
> $RequestHandler_12417a4b80b.service($RequestHandler_12417a4b80b.java)
>        at
> com.java.dse.cwp.eos.services.EosModule$1.service(EosModule.java:254)
>        at
> $RequestFilter_12417a4b806.service($RequestFilter_12417a4b806.java)
>        at
> $RequestHandler_12417a4b80b.service($RequestHandler_12417a4b80b.java)
>        at
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
>        at
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81)
>        at
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
>        at
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
>        at
> $RequestHandler_12417a4b80b.service($RequestHandler_12417a4b80b.java)
>        at
> $RequestHandler_12417a4b800.service($RequestHandler_12417a4b800.java)
>        at
> org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:197)
>        at
> org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
>        at
> $HttpServletRequestHandler_12417a4b802.service($HttpServletRequestHandler_12417a4b802.java)
>        at
> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>        at
> $HttpServletRequestFilter_12417a4b7ff.service($HttpServletRequestFilter_12417a4b7ff.java)
>        at
> $HttpServletRequestHandler_12417a4b802.service($HttpServletRequestHandler_12417a4b802.java)
>        at
> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:726)
>        at
> $HttpServletRequestHandler_12417a4b802.service($HttpServletRequestHandler_12417a4b802.java)
>        at
> $HttpServletRequestHandler_12417a4b7fd.service($HttpServletRequestHandler_12417a4b7fd.java)
>        at
> org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:127)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>        at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>        at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>        at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>        at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>        at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>        at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>        at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
>        at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>        at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
>        at java.lang.Thread.run(Thread.java:637)
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at
> classpath:com/java/dse/cwp/eos/pages/Search.tml, line 130]
>        at
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:495)
>        at
> org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:378)
>        at
> org.apache.tapestry5.corelib.components.Form$onAction$invocation_12417a50156.invokeAdvisedMethod(Form$onAction$invocation_12417a50156.java)
>        at
> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
>        at
> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
>        at
> org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
>        at
> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
>        at org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
>        at
> org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:910)
>        at
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1081)
>        ... 52 more
> Caused by: java.lang.NullPointerException
>        at
> org.apache.tapestry5.corelib.components.Loop.restoreStateFromStoredClientValue(Loop.java:457)
>        at
> org.apache.tapestry5.corelib.components.Loop.access$500(Loop.java:44)
>        at
> org.apache.tapestry5.corelib.components.Loop$RestoreStateFromStoredClientValue.execute(Loop.java:165)
>        at
> org.apache.tapestry5.corelib.components.Loop$RestoreStateFromStoredClientValue.execute(Loop.java:154)
>        at
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:480)
>        ... 62 more
>
>
> I would really appreciate some help understanding why this is broken.
>
> Thanks,
>
> Levi
>
>
> xfile80303 wrote:
>>
>> Hello all,
>>
>> I'm seing some interesting behavior I hope you can help me sort out.
>>
>> I have a form which I would like to display an error message (custom)
>> should the form validation fail.  I'd like to do this via AJAX since the
>> contents of the form are created via AJAX and refreshing the page to
>> display this error message will lose this context.
>>
>> So, I have something like this:
>>
>> <t:zone t:id="nothingSelectedZone" id="nothingSelectedZone"
>> visible="${errorVisible}">
>>   No items have been selected.
>> </t:zone>
>>
>> <t:zone t:id="resultsZone" id="resultsZone" visible="${resultsVisible}">
>>   <form t:id="parts" t:zone="nothingSelectedZone">
>>     <input type="button" t:type="submit" value="Do It"/>
>>   </form>
>> </t:zone>
>>
>> void onValidateFormFromParts()
>> {
>>   if (isValid())
>>   {
>>     _parts.recordError("No items selected.");
>>   }
>>   else
>>   {
>>     _parts.clearErrors();
>>   }
>>   errorVisible = _parts.getHasErrors();
>> }
>>
>> Object onSuccessFromParts()
>> {
>>   return otherPage;
>> }
>>
>> Object onFailureFromParts()
>> {
>>   return nothingSelectedZone.getBody();
>> }
>>
>> If there's no error with validation, the success method gets called fine,
>> and I am redirected to the otherPage.
>> If there is an error with validation, the nothingSelectedZone is updated
>> and the error message is displayed.
>> However, if, after a validation error I try to re-submit the form, nothing
>> happens at all.  I've put breakpoints in my debugger on these three
>> methods and they don't get hit in this case.  It's as if the form submit
>> is not taking place after the initial validation error.
>>
>> I'd love some input.
>>
>> Thanks,
>>
>> Levi
>>
>>
>
> --
> View this message in context: 
> http://n2.nabble.com/T5-1-AJAX-Form-Validation-tp3753039p3758403.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to