Hi Danushka, No I didnt write a function in block. Function was written in utils.jag
Thanks On Wed, Feb 18, 2015 at 8:55 PM, Danushka Fernando <danush...@wso2.com> wrote: > Hi Mahesh > I am not sure whether u r doing the correct thing. AFAIU you are adding a > function in block. Which means you are writing some business logic in > block. Which is not good I think. You should write all business logic in > module layer. > > Thanks & Regards > Danushka Fernando > Software Engineer > WSO2 inc. http://wso2.com/ > Mobile : +94716332729 > > On Wed, Feb 18, 2015 at 11:19 AM, Mahesh Chinthaka <mahe...@wso2.com> > wrote: > >> Thanks Ruchira, >> The mistake I had done was keeping variable name and calling function >> name same. >> i.e : var deleteButtonVisible = deleteButtonVisible(currentStage); >> >> This leads to a confusion, therefore we need to keep variable name and >> the function name different >> I got it fixed doing like this. >> >> var isDeleteButtonVisible = deleteButtonVisible(currentStage); >> >> >> >> On Wed, Feb 18, 2015 at 10:55 AM, Ruchira Wageesha <ruch...@wso2.com> >> wrote: >> >>> >>> >>> On Wed, Feb 18, 2015 at 10:51 AM, Mahesh Chinthaka <mahe...@wso2.com> >>> wrote: >>> >>>> Hi, >>>> >>>> After adding new method in a block.jag file im getting following error. >>>> Need helps please. >>>> >>>> TID: [0] [AF] [2015-02-18 10:49:56,109] ERROR >>>> {org.jaggeryjs.jaggery.core.manager.WebAppManager} - >>>> org.mozilla.javascript.EcmaError: TypeError: >>>> org.mozilla.javascript.Undefined@50464b2a is not a function, it is >>>> undefined. (/appmgt/site/blocks/resources/externalapi/add/block.jag#36) >>>> {org.jaggeryjs.jaggery.core.manager.WebAppManager} >>>> >>>> org.jaggeryjs.scriptengine.exceptions.ScriptException: >>>> org.mozilla.javascript.EcmaError: TypeError: >>>> org.mozilla.javascript.Undefined@50464b2a is not a function, it is >>>> undefined. (/appmgt/site/blocks/resources/externalapi/add/block.jag#36) >>>> >>> This explains the error, i.e. You expect a variable to be a function and >>> try to call it. But, it hasn't actually got assigned a value. >>> >>>> at >>>> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571) >>>> >>>> at >>>> org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273) >>>> >>>> at >>>> org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:541) >>>> >>>> at >>>> org.jaggeryjs.jaggery.core.JaggeryServlet.doGet(JaggeryServlet.java:24) >>>> >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) >>>> >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >>>> >>>> at >>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) >>>> >>>> at >>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) >>>> >>>> at >>>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) >>>> >>>> at >>>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487) >>>> >>>> at >>>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379) >>>> >>>> at >>>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339) >>>> >>>> at >>>> org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21) >>>> >>>> at >>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) >>>> >>>> at >>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) >>>> >>>> at >>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) >>>> >>>> at >>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) >>>> >>>> at >>>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) >>>> >>>> at >>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) >>>> >>>> at >>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) >>>> >>>> at >>>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178) >>>> >>>> at >>>> org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47) >>>> >>>> at >>>> org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56) >>>> >>>> at >>>> org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47) >>>> >>>> at >>>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141) >>>> >>>> at >>>> org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156) >>>> >>>> at >>>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) >>>> >>>> at >>>> org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52) >>>> >>>> at >>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) >>>> >>>> at >>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) >>>> >>>> at >>>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) >>>> >>>> at >>>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) >>>> >>>> at >>>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653) >>>> >>>> at >>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >>>> >>>> at >>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >>>> >>>> at java.lang.Thread.run(Thread.java:744) >>>> >>>> Caused by: org.mozilla.javascript.EcmaError: TypeError: >>>> org.mozilla.javascript.Undefined@50464b2a is not a function, it is >>>> undefined. (/appmgt/site/blocks/resources/externalapi/add/block.jag#36) >>>> >>>> at >>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687) >>>> >>>> at >>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665) >>>> >>>> at >>>> org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693) >>>> >>>> at >>>> org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3712) >>>> >>>> at >>>> org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3767) >>>> >>>> at >>>> org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3755) >>>> >>>> at >>>> org.mozilla.javascript.ScriptRuntime.getValueFunctionAndThis(ScriptRuntime.java:2286) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.site.blocks.resources.externalapi.add.c0._c_anonymous_3(/appmgt/site/blocks/resources/externalapi/add/block.jag:36) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.site.blocks.resources.externalapi.add.c0.call(/appmgt/site/blocks/resources/externalapi/add/block.jag) >>>> >>>> at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.jagg.c0._c_anonymous_26(/appmgt/jagg/jagg.jag:217) >>>> >>>> at org.jaggeryjs.rhino.appmgt.jagg.c0.call(/appmgt/jagg/jagg.jag) >>>> >>>> at >>>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.jagg.c0._c_anonymous_27(/appmgt/jagg/jagg.jag:277) >>>> >>>> at org.jaggeryjs.rhino.appmgt.jagg.c0.call(/appmgt/jagg/jagg.jag) >>>> >>>> at >>>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.jagg.c0._c_anonymous_26(/appmgt/jagg/jagg.jag:212) >>>> >>>> at org.jaggeryjs.rhino.appmgt.jagg.c0.call(/appmgt/jagg/jagg.jag) >>>> >>>> at >>>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.jagg.c0._c_anonymous_27(/appmgt/jagg/jagg.jag:277) >>>> >>>> at org.jaggeryjs.rhino.appmgt.jagg.c0.call(/appmgt/jagg/jagg.jag) >>>> >>>> at >>>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.jagg.c0._c_anonymous_26(/appmgt/jagg/jagg.jag:212) >>>> >>>> at org.jaggeryjs.rhino.appmgt.jagg.c0.call(/appmgt/jagg/jagg.jag) >>>> >>>> at >>>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.jagg.c0._c_anonymous_39(/appmgt/jagg/jagg.jag:446) >>>> >>>> at org.jaggeryjs.rhino.appmgt.jagg.c0.call(/appmgt/jagg/jagg.jag) >>>> >>>> at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.site.pages.c4._c_anonymous_1(/appmgt/site/pages/externalapi.jag:26) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.site.pages.c4.call(/appmgt/site/pages/externalapi.jag) >>>> >>>> at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.site.pages.c4._c_script_0(/appmgt/site/pages/externalapi.jag:24) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.site.pages.c4.call(/appmgt/site/pages/externalapi.jag) >>>> >>>> at >>>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394) >>>> >>>> at >>>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.site.pages.c4.call(/appmgt/site/pages/externalapi.jag) >>>> >>>> at >>>> org.jaggeryjs.rhino.appmgt.site.pages.c4.exec(/appmgt/site/pages/externalapi.jag) >>>> >>>> at >>>> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567) >>>> >>>> ... 35 more >>>> >>>> -- >>>> *Mahesh Chinthaka Vidanagama* | Software Engineer >>>> WSO2, Inc | lean. enterprise. middleware. >>>> #20, Palm Grove, Colombo 03, Sri Lanka >>>> Mobile: +94 71 63 63 083 | Work: +94 112 145 345 >>>> Email: mahe...@wso2.com | Web: www.wso2.com >>>> >>> >>> >>> >>> -- >>> >>> *Ruchira Wageesha**Associate Technical Lead* >>> *WSO2 Inc. - lean . enterprise . middleware | wso2.com >>> <http://wso2.com>* >>> >>> *email: ruch...@wso2.com <ruch...@wso2.com>, blog: >>> ruchirawageesha.blogspot.com <http://ruchirawageesha.blogspot.com>, >>> mobile: +94 77 5493444 <%2B94%2077%205493444>* >>> >> >> >> >> -- >> *Mahesh Chinthaka Vidanagama* | Software Engineer >> WSO2, Inc | lean. enterprise. middleware. >> #20, Palm Grove, Colombo 03, Sri Lanka >> Mobile: +94 71 63 63 083 | Work: +94 112 145 345 >> Email: mahe...@wso2.com | Web: www.wso2.com >> >> _______________________________________________ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > -- *Mahesh Chinthaka Vidanagama* | Software Engineer WSO2, Inc | lean. enterprise. middleware. #20, Palm Grove, Colombo 03, Sri Lanka Mobile: +94 71 63 63 083 | Work: +94 112 145 345 Email: mahe...@wso2.com | Web: www.wso2.com
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev