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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

myVars.sendAndLoad issues

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
CA
Hi,

I have created a survey in Flash MX 2004 (Win2k Pro) and am having problems communicating with the CGI script.

The script is outputting, for example:
Code:
&errMsg=Please fill in all fields;

Code:
qCount = 14; //number of survey questions
survey_name = "yac_survey_conf1"; //unique survey name
myVars = new LoadVars();
myVarsResponse = new LoadVars();
myVarsResponse.onLoad = handleData;
btnSubmit.onRelease = function(){
	btnSubmit.enabled = 0;
	_global.statusMsg = "Sending...";
	//store all answers in the myVars object
	for(i=1;i<=qCount;i++){
		myVars["q"+i] = eval("q"+i).selectedData;
		if(eval("q"+i+"comments").text != ""){
			myVars["q"+i] += ":"+eval("q"+i+"comments").text;
		}
		trace(i+".) "+myVars["q"+i]);
		//set message if field was left empty
		if(myVars["q"+i]==null){
			_global.statusMsg = "Please fill in all fields.";
		}
	}
	//retrieve entered userid/password
	myVars.userid = userid.text;
	myVars.passwd = passwd.text;
	//check if userid and password were entered
	if(userid.text==null||passwd.text==null){
		_global.statusMsg = "Please enter your userID and password.";
	}
	checkAnswers();
}
function checkAnswers(){
	if(_global.statusMsg==null){
		//form appears to be filled properly
		_global.statusMsg = "Submitting data...";
		myVars.sendAndLoad("[URL unfurl="true"]http://localhost/cgi-bin/survey.cgi",myVarsResponse,"GET");[/URL]
	}else{
		handleData();
	}
}
function handleData(){
	//go to status screen
	_global.statusMsg = myVarsResponse.errMsg;
	_parent._parent._parent.statusWindow.play();
	trace(_global.statusMsg);
}

The statusWindow ActionScript is (this frame is called after the variables have been set):
Code:
stop();
msg = _global.statusMsg;
btnClose.onRelease = function(){
	_parent.surveyMain.myTarget.myContent.btnSubmit.enabled = 1;
	play();
}

The issues I am aware of at this point:

1. _global.statusMsg is tracing back as undefined, in any circumstance.
2. statusWindow displays but shows no dynamic text.

Any help is appreciated. Deadline looming.

Thanks.

frozenpeas
--
Micfo.com Affiliate Program
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top