TypeError: Error #2007: Parameter text must be non-null.

Hi ,

I have an issue. I have made a website in flash and the contact form is designed and linked with php

as3 code:

[code]processing_mc.visible = false;

var variables:URLVariables = new URLVariables;

var varSend:URLRequest = new URLRequest(“form_parse.php”);
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

var varLoader:URLLoader = new URLLoader();
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);

function completeHandler(event:Event):void {
processing_mc.visible=false;
name_txt.text="";
email_txt.text="";
msg_txt.text="";
//load response on php here
status_txt.text=“In submit button”;
status_txt.text = event.target.data.return_msg;

}
//add event listener to Submit button
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
//funtion validate and send
function ValidateAndSend(event:MouseEvent):void{
//validate fields

if(!name_txt.length){
	status_txt.text="Please enter your Name";
} else if(!email_txt.text){
	status_txt.text="Please enter your E-mail address";
} else if(!msg_txt.text){
	status_txt.text="Please enter your Message";
} else {
	
	//all is good, send data to php
	processing_mc.visible=true;
	//ready the variables to send
	variables.userName = name_txt.text;
	variables.userEmail = email_txt.text;
	variables.userMsg = msg_txt.text;
	
	// send the data to php now.
	varLoader.load(varSend);
	
}//close for error handling

}//close validate and send function

[/code]

php code:

[php]

<?php $senderName =$POST['userName']; $senderEmail =$POST['userEmail']; $senderMsg =$POST['userMsg']; $senderName =stripslashes('userName'); $senderEmail =stripslashes('userEmail'); $senderMsg =stripslashes('userMsg'); $to="[email protected]"; $from="$senderEmail"; $subject="enquiry"; $message=" Enquiry from: Name:$senderName Email:$senderEmail The message sent : Message:$senderMsg"; $headers= "From:$from\r\n"; $headers= "Content-type:text\r\n"; $to= "$to"; mail($to,$subject,$message,$headers); $my_msg="Thanks $senderName,your data has been sent"; print"return_msg=$my_msg"; exit(); ?>

[/php]

but i m getting an error:

TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at AS3_PHP_Components_Form_fla::wholeForm_1/completeHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()

Somehow i m unable to figure the prob…Please help…

if(!name_txt.length){ i think is wrong. you’re not telling it how long that string should be. your other if statements are looking for something in the box, the name_txt one isn’t, its testing the length.

Richei, doesn’t that IF test for the .length not equal to zero?

Also, Hina, remove this line: $to= “$to”; It does nothing!

Also, it appears you cross-posted on another site. On that site, they told you to use your debugger and locate the line where the error is on in the flash part. If we know the line where the error occurs, we can help you figure out the error better. Here is a link to their reply to you:
http://stackoverflow.com/questions/11683146/typeerror-error-2007-parameter-text-must-be-non-null

Sponsor our Newsletter | Privacy Policy | Terms of Service