Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Abderahmen on Jan 19, 2010 01:24
open dhtmlx forum
server side problem

Hello,

I'm trying to set up a new insert method as following :
<cfinclude template="config.cfm">

<cfinclude template="#request.stMapping.strCFC#.admin.DB_MSSQL"

<cffunction name="insert_related">
    <cfargument name="action">
    <cfset var local  = structNew()>
    <cfset local.status = ARGUMENTS.action.get_status()>
    <cfset local.id = ARGUMENTS.action.get_id()>
    <cfset local.start_date = ARGUMENTS.action.get_value("start_date")>
    <cfset local.end_date = ARGUMENTS.action.get_value("end_date")>
    <cfset local.event_name = ARGUMENTS.action.get_value("event_name")>
    <cfset local.details = ARGUMENTS.action.get_value("details")>
    <cfset local.SY_UUID = session.lSY.getUUID()>
    <cfset local.categoryid = ARGUMENTS.action.get_value("categoryid")>
<!---    <cfset local.is_publicyn = ARGUMENTS.action.get_value("is_publicyn")>
--->
    <cfif local.status eq "inserted">
        <cfset request.scheduler.sql.query("INSERT INTO TBL_EVENTS(start_date,end_date,event_name,details,SY_UUID,categoryid,is_publicyn)VALUES('"&local.start_date&"','"&local.end_date&"','"&local.event_name&"','"&local.details&"','"&local.SY_UUID&"','"&local.categoryid&"','1')">
        <cfset ARGUMENTS.action.success()>
    </cfif>       
</cffunction>

<cfset scheduler = createObject("component",request.dhtmlxConnectors["scheduler"]).init(request.dhtmlxConnectors["datasource"],"","","")>
<cfset scheduler.event.attach("beforeInsert",insert_related)>
<cfset scheduler.render_table("TBL_EVENTS","event_id","start_date,end_date,event_name,details,SY_UUID,categoryid,is_publicyn")>
<cfset request.scheduler = scheduler>

The problem is that i have an XML error :
Error type: LoadXML
Description: Incorrect XML

Can you help please.

Regards
Abderahmen
Answer posted by CFM Support on Jan 19, 2010 01:58
Hi
The xml error means that cfm page is incorrect and there is server error.
If you use the exact code that you've sent to us - there is incorrect cfm code in some places.

The list of bugs in the code at first site:
1) <cfinclude template="#request.stMapping.strCFC#.admin.DB_MSSQL"
the ">" is missing in the end of the cfinclude tag.

2) <cfset request.scheduler.sql.query("INSERT INTO TBL_EVENTS(start_date,end_date,event_name,details,SY_UUID,categoryid,is_publicyn)VALUES('"&local.start_date&"','"&local.end_date&"','"&local.event_name&"','"&local.details&"','"&local.SY_UUID&"','"&local.categoryid&"','1')">

The ")" is missing in the end of the line (before ">").
Correct one:
<cfset request.scheduler.sql.query("INSERT INTO TBL_EVENTS(start_date,end_date,event_name,details,SY_UUID,categoryid,is_publicyn)VALUES('"&local.start_date&"','"&local.end_date&"','"&local.event_name&"','"&local.details&"','"&local.SY_UUID&"','"&local.categoryid&"','1')")>

After fixing these two bugs the xml is generated correctly.
To check for other bugs you can try to call the page in browser <path>/events.cfm, where "events.cfm" is the template that contains the code you've sent. If there are any cfm compilation errors you'll see them.

Best regards
Support