0 Replies Latest reply on Aug 15, 2007 2:07 PM by skyhead03

    loadVars not returning values

    skyhead03 Level 1
      I'm trying to update a database by sending a value to a cf page.
      The page works. Any lessonID NEQ 0 returns an allGood-1 , allGood=0 if there is an error in the database update.
      For EX. http://www.netspeaknow.com/flashCFM/lessonID.cfm?lessonID=18
      returns allGood-1

      When I send my lessonId with loadVars The database is getting updated but my return value is "allGood-undefined"
      What am I doing wrong?

      Here's my Flash code:

      function loadLessonWords(lessonID:Number){
      trace("passed id=" + lessonID) // the lessonID is getting passed correctly
      var wordVars = new LoadVars;
      wordVars.onLoad = onWordVarsLoaded;
      wordVars.load(" http://www.netspeaknow.com/flashCFM/lessonID.cfm?lessonID=" + lessonID );
      function onWordVarsLoaded() {
      if (this.allGood == "0") {
      trace("onWordVarsLoaded - error - allGood=" + allGood);
      } else {
      trace("onWordVarsLoaded - success - allGood=" + allGood); // traces as allGood=undefined

      The CF code:

      <cfparam name="URL.lessonID" type="numeric" default="0" />
      <cfparam name="allGood" type="numeric" default="0"/>

      <cfif #URL.lessonID# NEQ 0>
      <cftransaction action="begin">
      <cfset inTran = "begin">
      <cfquery name="updateLessonID" datasource="langDB">
      Update Users
      Set lastLessonID = #URL.lessonID#
      Where userID = 1
      <cfset inTran = "Updated Info">
      <cfif inTran EQ "Updated Info">
      <cfset allGood = '1'>
      <cftransaction action="commit"/>
      <cfset allGood = '0' >
      <cftransaction action="rollback"/>

      <cfsetting showdebugoutput="no" enablecfoutputonly="yes">
      <cfcontent type="text/plain" reset="yes">