Hi Guys, I am trying to work with code provided on this page
wiki.coldbox.org/wiki/Models.cfm “Model Integration Guide” and I’ve copy pasted the code and created files like here:
<i>+ handlers
+ contacts.cfc
+ model
+ ContactService.cfc
+ ContactDAO.cfc
+ Contact.cfc</i>
but it seems that I am missing something with validation. When I submit the page in save mode http://localhost:8081/samples/helloworld/index.cfm?event=contacts.save…
I get this error:
An Unhandled Exception Occurred
An unhandled exception has occurred. Please look at the diagnostic information below:
Type expression
Message No matching function [VALIDATEMODEL] found
Detail
Extended Info
Message No matching function [VALIDATEMODEL] found
Tag Context /Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/samples/helloWorld/handlers/contacts.cfc (60)
/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/coldbox/system/mvc/EventHandler.cfc (60)
/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/coldbox/system/mvc/Controller.cfc (361)
/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/coldbox/system/mvc/Bootstrap.cfc (153)
/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/samples/helloWorld/Application.cfc (57)
Stack Trace No matching function [VALIDATEMODEL] found at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:702):702 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:709):709 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1455):1455 at samples.helloworld.handlers.contacts_cfc$cf.udfCall(/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/samples/helloWorld/handlers/contacts.cfc:60):60 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:106):106 at railo.runtime.type.UDFImpl._call(UDFImpl.java:377):377 at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:276):276 at railo.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:709):709 at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:735):735 at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1465):1465 at coldbox.system.mvc.eventhandler_cfc$cf.udfCall(/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/coldbox/system/mvc/EventHandler.cfc:60):60 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:106):106 at railo.runtime.type.UDFImpl._call(UDFImpl.java:377):377 at railo.runtime.type.UDFImpl.call(UDFImpl.java:283):283 at railo.runtime.ComponentImpl._call(ComponentImpl.java:569):569 at railo.runtime.ComponentImpl._call(ComponentImpl.java:487):487 at railo.runtime.ComponentImpl.call(ComponentImpl.java:1698):1698 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:709):709 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1455):1455 at coldbox.system.mvc.controller_cfc$cf._1(/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/coldbox/system/mvc/Controller.cfc:361):361 at coldbox.system.mvc.controller_cfc$cf.udfCall(/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/coldbox/system/mvc/Controller.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:106):106 at railo.runtime.type.UDFImpl._call(UDFImpl.java:377):377 at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:276):276 at railo.runtime.ComponentImpl._call(ComponentImpl.java:570):570 at railo.runtime.ComponentImpl._call(ComponentImpl.java:487):487 at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1715):1715 at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:735):735 at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1465):1465 at coldbox.system.mvc.bootstrap_cfc$cf._1(/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/coldbox/system/mvc/Bootstrap.cfc:153):153 at coldbox.system.mvc.bootstrap_cfc$cf.udfCall(/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/coldbox/system/mvc/Bootstrap.cfc):-1 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:106):106 at railo.runtime.type.UDFImpl._call(UDFImpl.java:377):377 at railo.runtime.type.UDFImpl.call(UDFImpl.java:283):283 at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:700):700 at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:709):709 at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1455):1455 at samples.helloworld.application_cfc$cf.udfCall(/Users/now/Documents/workspace/coldbox-devbox_2.4/webapps/ROOT/samples/helloWorld/Application.cfc:57):57 at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:106):106 at railo.runtime.type.UDFImpl._call(UDFImpl.java:377):377 at railo.runtime.type.UDFImpl.call(UDFImpl.java:283):283 at railo.runtime.ComponentImpl._call(ComponentImpl.java:569):569 at railo.runtime.ComponentImpl._call(ComponentImpl.java:487):487 at railo.runtime.ComponentImpl.call(ComponentImpl.java:1698):1698 at railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:372):372 at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:108):108 at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:18):18 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2113):2113 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2081):2081 at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:318):318 at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:29):29 at javax.servlet.http.HttpServlet.service(HttpServlet.java:97):97 at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109):109 at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156):156 at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95):95 at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289):289 at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838):838 at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1309):1309 at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1265):1265 at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1249):1249 at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1157):1157 at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:956):956 at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:117):117 at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93):93 at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169):169 at com.caucho.network.listen.TcpSocketAcceptThread.run(TcpSocketAcceptThread.java:61):61 at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173):173 at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118):118
Here is the Save method in contacts.cfc I am using:
function save(event,rc,prc){
event.paramValue(“contactID”,0);
var contact = populateModel( contactService.get( rc.contactID ) );
// validate it
var vResults = validateModel(contact);
// Check it
if( vResults.hasErrors() ){
getPlugin(“MessageBox”).error(messageArray=vResults.getAllErrors());
return newContact(event,rc,prc);
}
else{
getPlugin(“MessageBox”).info(“Contact created!”);
setNextEvent(“contacts”);
}
}
Can you please advise?
Thank you.
Dejan