cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Gallardo <agalla...@agssa.net>
Subject Re: Error when adding in Javascript for form validation
Date Sat, 18 Mar 2006 07:27:21 GMT
Hi Derek,

Sorry for my delay.

I've tested the same validator in cocoon 2.1.8 and it works. Something like:
<fd:repeater id="myRepeater" initial-size="1" min-size="1">
<fd:validation>
<fd:javascript>return true;</fd:javascript>
</fd:validation>
<fd:widgets>
<fd:field id="repeaterField1" required="true">
.......


Best Regards,

Antonio Gallardo.




Derek Hohls wrote:

>Antonio
> 
>In my cocoon.xconf I have:
> 
> <forms-validators>
>   <!-- new-style validators -->
>   <validator class="org.apache.cocoon.forms.validation.impl.JavaScriptValidatorBuilder"
name="javascript"/>
>  ...
> </forms-validators>
> 
>Is this what you meant?
> 
> 
>My validation is for a repeater row: the XML now looks like:
> 
><fd:repeater id="dsdata" size="5">
> 
>  <fd:validation>
>    <fd:javascript>
>      return true;
>    </fd:javascript> 
>  </fd:validation>  
> 
>  <fd:widgets>
>  ...
> 
>The stack trace looks like:
> 
>Original Exception: java.lang.NullPointerException
>	at org.mozilla.javascript.tools.debugger.Main.handleCompilationDone(Main.java:2414)
>	at org.mozilla.javascript.Interpreter.generateFunctionICode(Interpreter.java:250)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.generateFunctionICode(ContinuationInterpreter.java:1821)
>	at org.mozilla.javascript.Interpreter.compile(Interpreter.java:96)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.compile(ContinuationInterpreter.java:1806)
>	at org.mozilla.javascript.Context.compile(Context.java:2004)
>	at org.mozilla.javascript.Context.compile(Context.java:1897)
>	at org.mozilla.javascript.Context.compileFunction(Context.java:927)
>	at org.apache.cocoon.forms.util.JavaScriptHelper.buildFunction(JavaScriptHelper.java:99)
>	at org.apache.cocoon.forms.validation.impl.JavaScriptValidatorBuilder.build(JavaScriptValidatorBuilder.java:53)
>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>	at java.lang.reflect.Method.invoke(Unknown Source)
>	at org.apache.avalon.excalibur.component.ComponentProxyGenerator$ComponentInvocationHandler.invoke(ComponentProxyGenerator.java:143)
>	at $Proxy10.build(Unknown Source)
>	at org.apache.cocoon.forms.formmodel.AbstractWidgetDefinitionBuilder.setValidators(AbstractWidgetDefinitionBuilder.java:150)
>	at org.apache.cocoon.forms.formmodel.RepeaterDefinitionBuilder.buildWidgetDefinition(RepeaterDefinitionBuilder.java:37)
>	at org.apache.cocoon.forms.formmodel.AbstractWidgetDefinitionBuilder.buildAnotherWidgetDefinition(AbstractWidgetDefinitionBuilder.java:87)
>	at org.apache.cocoon.forms.formmodel.FormDefinitionBuilder.buildWidgetDefinition(FormDefinitionBuilder.java:41)
>	at org.apache.cocoon.forms.DefaultFormManager.getFormDefinition(DefaultFormManager.java:134)
>	at org.apache.cocoon.forms.DefaultFormManager.getFormDefinition(DefaultFormManager.java:122)
>	at org.apache.cocoon.forms.DefaultFormManager.createForm(DefaultFormManager.java:96)
>	at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source)
>	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>	at java.lang.reflect.Method.invoke(Unknown Source)
>	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:230)
>	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138)
>	at org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121)
>	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:702)
>	at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.invoke(ActTypeNode.java:138)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
>	at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
>	at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
>	at org.apache.cocoon.Cocoon.process(Cocoon.java:639)
>	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1098)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
>	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
>	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
>	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
>	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
>	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
>	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
>	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
>	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
>	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
>	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
>	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
>	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
>	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
>	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
>	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
>	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
>	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
>	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
>	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
>	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
>	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
>	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
>	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
>	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
>	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
>	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
>	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
>	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
>	at java.lang.Thread.run(Unknown Source)
>
>
>
>  
>
>>>>agallardo@agssa.net 2006/03/07 08:32 AM >>>
>>>>        
>>>>
>Derek Hohls wrote:
>
>  
>
>>Antonio
>>
>>I do not understand - I thought Javascript validation was 
>>pretty much a standard and tested part of CForms for a 
>>while now... are you saying it *never* worked in 2.1.5?!
>>
>>
>>    
>>
>Nope. Sorry for my previous mail. It works in 2.1.5. I though the 
>problem was 2 javascript statements in the same line.
>
>Question, do you have the javascript validator defined in your cocoon.xconf?
>
>Have you tried to use:
>
><fd:validation>
><fd:javascript>
>return true;
></fd:javascript> 
></fd:validation>
>
>To check if this works? Can you post the NPE stack trace?
>
>
>Best Regards,
>
>Antonio Gallardo.
>
>  
>
>>Thanks
>>Derek
>>
>>
>>
>>    
>>
>>>>>agallardo@agssa.net 2006/02/28 09:17 AM >>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>Derek Hohls wrote:
>>
>>
>>
>>    
>>
>>>(Cocoon 2.1.5)
>>>
>>>I get the dreaded java.lang.NullPointerException when 
>>>I try and introduce Javascript validation into a form. 
>>>I strippped all the logic out down to an abolsutely basic:
>>>
>>><fd:validation>
>>><fd:javascript>
>>>var success = true;
>>>return success; 
>>></fd:javascript> 
>>></fd:validation>
>>>
>>>but this does not work - commenting out the 
>>>
>>><fd:javascript>
>>>var success = true; return success; 
>>></fd:javascript> 
>>>
>>>immediately allows the form to be displayed.
>>>
>>>This error happens no matter which field of the form
>>>the above code block is assigned to.
>>>
>>>What obvious issue am I overlooking??
>>>
>>>
>>>
>>>
>>>      
>>>
>>Seems to be a bug.
>>
>>Best Regards,
>>
>>Antonio Gallardo.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>>For additional commands, e-mail: users-help@cocoon.apache.org 
>>
>>
>>
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>For additional commands, e-mail: users-help@cocoon.apache.org 
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message