I'm new in Cfwheel , hasError() getting issue

38 views
Skip to first unread message

bibin varghese

unread,
Jun 26, 2014, 1:50:33 AM6/26/14
to cfwh...@googlegroups.com

 Hi All, 


I'm new in Cfwheel  


If i'm trying to  use error function hasError() getting issue , please let me know





/controller/cfc file

    <cffunction name="Create">

<cfset emphis = model("EMP_HISTORY").new(params.emphis)>

   <cfset emphis = emphis.save()>

<cfif emphis.hasErrors()>

<cfset renderPage(action="emp")>

</cfif>

</cffunction>

/model/cfc file 

<cfcomponent displayname="emp model" extends="model">

    <cffunction name="init"> 

        <cfset table("EMP_HISTORY")> 

        <cfset validatesPresenceOf("ID,COM_NAME")>

    </cffunction> 


</cfcomponent>



I'm getting following error 




The hasErrors method was not found.

Either there are no methods with the specified method name and argument types or the hasErrors method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
 
The error occurred inC:/ColdFusion11/cfusion/wwwroot/cf_on_wheels/controllers/Emp.cfc: line 12
Called from C:/ColdFusion11/cfusion/wwwroot/cf_on_wheels/wheels/global/cfml.cfm: line 174
Called from C:/ColdFusion11/cfusion/wwwroot/cf_on_wheels/wheels/controller/processing.cfm: line 85
Called from C:/ColdFusion11/cfusion/wwwroot/cf_on_wheels/wheels/controller/processing.cfm: line 60
Called from C:/ColdFusion11/cfusion/wwwroot/cf_on_wheels/wheels/dispatch/request.cfm: line 167
Called from C:/ColdFusion11/cfusion/wwwroot/cf_on_wheels/wheels/index.cfm: line 1
Called from C:/ColdFusion11/cfusion/wwwroot/cf_on_wheels/index.cfm: line 1
Called from C:/ColdFusion11/cfusion/wwwroot/cf_on_wheels/wheels/events/onrequest.cfm: line 1
10 : 	 	<cfset emphis = model("EMP_HISTORY").new(params.emphis)>
11 : 	    <cfset emphis = emphis.save()>
12 : 	 <cfif emphis.hasErrors()>
13 : 	 	<cfset renderPage(action="emp")>
14 : 	 </cfif>

Yannick Morin

unread,
Jun 26, 2014, 9:07:51 AM6/26/14
to ColdFusion on Wheels
Thy this <cfset emphis.save()> and not <cfset emphis = emphis.save()>

<cffunction name="Create">

<cfset emphis = model("EMP_HISTORY").new(params.emphis)>

   <cfset emphis.save()>

<cfif emphis.hasErrors()>

<cfset renderPage(action="emp")>

</cfif>

</cffunction>

--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfwheels+u...@googlegroups.com.
To post to this group, send email to cfwh...@googlegroups.com.
Visit this group at http://groups.google.com/group/cfwheels.
For more options, visit https://groups.google.com/d/optout.

Chris Peters

unread,
Jun 26, 2014, 9:08:15 AM6/26/14
to cfwh...@googlegroups.com
When you call this:
<cfset emphis = emphis.save()>

You're setting emphis to a true/false value. That will not have a hasErrors() method.

Consider rewriting as such:

<cffunction name="Create">
  <cfset emphis = model("EMP_HISTORY").new(params.emphis)>

   <cfif not emphis.save()>

<cfset renderPage(action="emp")>

   </cfif>

</cffunction>


On Thu, Jun 26, 2014 at 1:50 AM, bibin varghese <bibinvar...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfwheels+u...@googlegroups.com.
To post to this group, send email to cfwh...@googlegroups.com.
Visit this group at http://groups.google.com/group/cfwheels.
For more options, visit https://groups.google.com/d/optout.



--

Chris Peters
Web Developer
Liquifusion Studios

chris....@liquifusion.com
Skype: liquifusion.support
www.liquifusion.com
Reply all
Reply to author
Forward
0 new messages