Rob,

Since you are not outputting html with your component/function, try setting output="false" on the <cffunction> tag.

Carl

On 10/20/2010 10:07 AM, Rob wrote:
Hi Alan,

Thanks for the quick response.

Here is my component/function.  With this code, I still get:
CFML Runtime Error
The value returned from function insert_entity() is not of type json

I also tried to simply<cfset result = "Hi">  to see if something in my
setting the result was problematic, but same error.

Thanks,

Rob

<cfcomponent extends="ajax">
        <cffunction access="remote" name="insert_entity" output="true"
returntype="json">
                <cfargument name="company_name" required="no" type="string">
                <cfargument name="FK_ParentEntityID" required="no" 
type="string">
                <!--- check to see if the entity already exists --->
                <cfquery name="check_entity_clearance" 
datasource="#Session.DSN#">
                        select company_name, FK_EntityID
                        from entity_name
                        where company_name =<cfqueryparam 
cfsqltype="CF_SQL_VARCHAR"
value="#company_name#">
                </cfquery>

                <cfif check_entity_clearance.recordcount lt 1>
                        <cfquery name="insert_company_entity" 
datasource="#Session.DSN#">
                                insert into entity
                                (Date_Created)
                                values
                                (<cfqueryparam cfsqltype="CF_SQL_TIMESTAMP" 
value="#Now()#">)

                                select @@identity as new_id
                        </cfquery>

                        <!--- insert the name --->
                        <cfquery name="insert_name" datasource="#Session.DSN#">
                                insert into entity_name
                                (FK_EntityID,Company_Name)
                                values
                                (<cfqueryparam cfsqltype="CF_SQL_INTEGER"
value="#insert_company_entity.new_id#">,
                                <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="#Arguments.company_name#">)
                        </cfquery>
                        <cfset result.new_id = insert_company_entity.new_id>
                        <cfset result.message = "Saved">
                <cfelse>
                        <cfset result.new_id = 
check_entity_clearance.FK_EntityID>
                        <cfset result.message = "Company Name already exists">
                </cfif>
                <!---<cfset result = Serializejson(result,true,true)>  --->
                <cfreturn result />
        </cffunction>
</cfcomponent>


--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
official manual: http://www.openbluedragon.org/manual/
Ready2Run CFML http://www.openbluedragon.org/openbdjam/

mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to