Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem setting LoadVars variables through #include file

Status
Not open for further replies.

CorrieLee

Programmer
Oct 13, 2004
18
CA
Hi there,

My loadvars variables aren't setting through my include file. I have some error checking, and other things happening within that include file. The URL location for the sendAndLoad is the include file, and I need it to load the updated variables into another LoadVars Object (I tried using the same one, and a different one, neither is working..)

If my code to set in the include file is:
Code:
Response.Write "&strNoErrors=" & strNoErrors 
Response.Write "&strMode=" & strMode
Response.Write "&strControlNumber=" & strControlNumber
I get this back. [output] = Receiving_lv.strNoErrors = "

when the code has no '&' it comes back as [output] = 'undefined'.

when I hard code it in the include file to be a set value, it still comes back as ".

Any ideas?

Thanks,
Corrie.
 
I'm sure that all makes perfect sense to you...but could you provide a bit more detail? :)

You are using loadVars.sendAndLoad to send variables to an ASP page. Then what? The ASP page has an include file? The Flash movie has an include file? How did you structure your loadVars.sendAndLoad command?

Wow JT that almost looked like you knew what you were doing!
 
LOL, you mean your skills end at Flash and ASP? No mind-reading? ;)

Ok, I actually don't have an asp file. I have a .inc

I have a flash app that users put in ticket numbers to win a prize. The flash app creates a new LoadVars() object, assigns the ticket number, and some other info to variables of this object.

Code:
fValidate = function(){
var TicketNumber_lv:LoadVars 	= new LoadVars();
var Receiving_lv:LoadVars 	= new LoadVars();
//Store Data that the user has entered in preperation to send to .Net Application
        
TicketNumber_lv.strMode = "Validate";
TicketNumber_lv.strTktNumber = TicketNumber_txt.text;
	
	
URLLocation_str = "TicketValidation.inc";
	
Receiving_lv.onLoad = function(success){	
       Debug_txt.text += " success = " + success;
       if (success){
	  if (Receiving_lv.strNoErrors == "True"){
		TktNumber_str = TicketNumber_txt.text;
		gotoAndStop("Confirm");
	  } else {
	        var Message_str:String;
		Message_str = "\nYour entry is not a valid entry.";
		mx.controls.Alert.show(Message_str, "Ticket Entry Problems."); 
	  }			
	} else { //Failed
	return "False";
	}
}
TicketNumber_lv.sendAndLoad(URLLocation_str, Receiving_lv, "POST");
}

The data in the include file is this:
Code:
<!--#include file="TicketValidationInclude.inc"-->
'this include file has function below that returns true 
'or false if it is a valid ticket number.
<%

'these variables are inputs from Flash
dim istrMode
dim istrTktNumber
dim istrValid

istrMode = ""
istrTktNumber = ""

istrMode = Request.Form("strMode")
istrTktNumber = Request.Form("strTktNumber")

istrValid = fnlVerifyTicketNbr(istrTktNumber)

Response.Write "&strNoErrors=" & istrValid
Response.Write "&strMode2=" & istrMode
Response.Write "&strTktNumber=" & istrTktNumber

%>

So, it's *supposed* to be setting the variables (strNoErrors, strMode, strTktNumber) of the Receiving_lv so that I can tell if it's valid, etc... but, it's not giving me anything back, other than either 2 single quotes, or one double quote. -> "

As a side note, I originally started with only one LoadVars() object, and sendAndLoad-ing to the same LV, but.. that was working about as well as this is. ;)

Thanks again!
Corrie.
 
You need to save your page as an ASP.NET file (or ASP file), not a .inc file. IIS (or other server) will not execute the code in an include unless it is embedded in an asp page.

So just create a new page called processVars.asp(x) (or something like that) and place the same code in it that you have above. Change the URL to go to the new page and it should start doing something for you.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top