My server is also behind a strict firewall, not sure if that is my
problem. If it is what settings would I need to change?

-----Original Message-----
From: Peterson, Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 23, 2007 3:47 PM
To: CF-Talk
Subject: RE: CFC With Remote Access

Not sure about the differences from CF6 to 7, but you should add var
declarations to the beginning of your file to ensure no funky variable
values or un-expected behavior.  I would re-write it like this:

<CFFUNCTION name="FindPromoCode" returntype="string" output="no"
access="remote">
        <CFARGUMENT name="ThePromoCode" required="yes" type="string">
        <CFARGUMENT name="SubType" required="yes" type="string">
 
        <cfset var findPromoCode = '' />
        <cfset var isFound = 0 /> 

        <CFQUERY name="FindPromoCode" datasource="#request.dsource#" >
          SELECT SubscriptionType
          FROM SpecialOffers
          WHERE PromoCode = <cfqueryparam cfsqltype="cf_sql_varchar"
value="#arguments.thePromoCode#">
         </CFQUERY> 
  
        <CFIF FindPromoCode.recordcount GT 0 AND
FindPromoCode.SubscriptionType IS NOT "">
   
        <CFIF Arguments.SubType EQ FindPromoCode.SubscriptionType>
                <CFSET IsFound = 1 />
        <CFELSE>
                <CFSET IsFound = 2 /> 
        </CFIF>      
        </CFIF>
 
        <cfreturn IsFound />
 
</CFFUNCTION>

Chris Peterson
Gainey IT
Adobe Certified Advanced Coldfusion Developer -----Original Message-----
From: Chad McCue
Sent: Monday, July 23, 2007 3:33 PM
To: CF-Talk
Subject: CFC With Remote Access

I have a cfc that is called from JS that returns a string, works
perfectly on CF6 but is not working on CF7. My JS and cfc are below.
Again this exact code is working on my beta server with CF6 on it. The
production server is set up the same besides having CF7. When I try to
alert(result) on CF6 I get the correct value, when I do it on CF7 I get
a blank/empty value like the cfc was never called. If I do a
alert(objHTTP.status) after the objHTTP.send(null) I get a result of 200
 
var PromoCode = document.SubscriberForm.SpecialOfferCode.value;
   
   <CFOUTPUT>
   var strURL =
"#Request.webroot#Ajax/MyFunctions.cfc?Method=FindPromoCode&SubType=1&Th
ePromoCode=" + PromoCode;
   </CFOUTPUT>
 
   if(window.XMLHttpRequest) {    
    objHTTP = new XMLHttpRequest();
    objHTTP.open("GET", strURL, false);     
    objHTTP.send(null);   
    result = objHTTP.responseText; 
   }
   else if (window.ActiveXObject) {    
    objHTTP = new ActiveXObject("Microsoft.XMLHTTP");  
    objHTTP.open("GET",strURL,false);
    objHTTP.send(null);
    result = objHTTP.responseText;   
   } 
  
   var PromoCodeFound = result.substring(57,58); 
   
  
   if(PromoCodeFound == 1) {    
    return true; 
   }
   else if(PromoCodeFound == 2) {
    //alert("The promotion code entered is for a monthly subscription
you are signing up for a Pay-Per-Pick subscription.\n\n Please try
again.");
    return true;
   }
   else {   
    //alert("The promotion code entered was not found.\n\n Please try
again.");
    return true;
   }
 
This is my CFC
 
<cfcomponent>
 
<!--- Function to check the Promo Code ---> <CFFUNCTION
name="FindPromoCode" returntype="string" output="no"
access="remote">
 <CFARGUMENT name="ThePromoCode" required="yes" type="string">
<CFARGUMENT name="SubType" required="yes" type="string">
 
 <CFQUERY name="FindPromoCode" datasource="#request.dsource#" >
  SELECT SubscriptionType
  FROM SpecialOffers
  WHERE PromoCode = '#Arguments.ThePromoCode#'
 </CFQUERY> 
 
 <CFSET IsFound = 0 />
  
 <CFIF FindPromoCode.recordcount GT 0 AND FindPromoCode.SubscriptionType
IS NOT "">
   
  <CFIF Arguments.SubType EQ FindPromoCode.SubscriptionType>
   <CFSET IsFound = 1 />
  <CFELSE>
   <CFSET IsFound = 2 /> 
  </CFIF>      
 </CFIF>
 
 <cfreturn IsFound />
 
</CFFUNCTION>
 

</cfcomponent>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 beta - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284398
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to