Forms - Help!

Hi,
Im using FlashMX and have built a form for one page. however, i cannot get the AS to work properly. Any help or suggestions would be greatly appreciated. And I have already done many searches and read many threads in here on the subjects…

I have 4 layers: labels, code, text, components. I have put all the code on the first layer on the code layer. However, the reset button is not working properly and I cannot get the submit button to “Check” before going to “result”.

Last, do all the actions go in the first frame of “code” layer or do they go with each button? thanks, here is the code on frame 1 of the code layer.

stop();

// the Textarea is empty, so no scrollbar
_root.bar._visible =false;
// onChanged function
comment.onChanged =function() {
if (this.maxscroll > 1) {
_root.bar._visible = true;
} else
_root.bar._visible =false;

} //end onChanged

//Reset button function

onReset = function () {
//text
name.text = “”;
address.text = “”;
city.text = “”;
state.text = “”;
zip.text = “”;
email.text = “”;
homePhone.text = “”;
workPhone.text = “”;
comment.text = “”;
bar._visible = false;
} // end onReset function

onSubmit = function () {
if(!email.length || email.indexOf("@") == -1 || email.indexOf(".") == -1) {
emailStatus =“Please enter a valid E-Mail address”;
}
else if (!name.length) {
emailStatus = “Please enter your name before sending”;
}
else if(!comment.length) {
emailStatus = “Please enter some text in your message”;
}

	texte = name.text;
	text = address.text;
	text = city.text;
	text = state.text;
	text = zip.text;
	text = comment.text;
	_root.gotoAndStop ("result");

}

onBack = function () {
gotoAndStop(“form”);
}

onSend = function () {
LoadVariablesNum(“formScriptASP.aspx”, “0”, “POST”);
}

thanks and sorry about the messy format. Dave.

:q:

Real quick: you can format your actionscript code by placing AS tags around it:
[*as]some code here [/*as] (only without the asterisks).

The code needs to be:


stop();

// the Textarea is empty, so no scrollbar
_root.bar._visible =false;
// onChanged function
comment.onChanged =function() {
	if (this.maxscroll > 1) {
			_root.bar._visible = true;
	} else 	
			_root.bar._visible =false;
	
} //end onChanged

//Reset button function

onReset = function () {
		//text
		name.text = "";
		address.text = "";
		city.text = "";
		state.text = "";
		zip.text = "";
		email.text = "";
		homePhone.text = "";
		workPhone.text = "";
		comment.text = "";
		bar._visible = false;
}  // end onReset function

onSubmit = function () {
	if(!email.length || email.indexOf("@") == -1 || email.indexOf(".") == -1) {
		emailStatus ="Please enter a valid E-Mail address";
	} 
	else if (!name.length) {
		emailStatus	= "Please enter your name before sending";
	}
	else if(!comment.length) {
		emailStatus = "Please enter some text in your message";	
	} else {
		
		texte = name.text;
		text = address.text;
		text = city.text;
		text = state.text;
		text = zip.text;
		text = comment.text;
		_root.gotoAndStop ("result");
	}
}

The key is these lines:


} else {
		
		texte = name.text;
		text = address.text;
		text = city.text;
		text = state.text;
		text = zip.text;
		text = comment.text;
		_root.gotoAndStop ("result");
	}
}

Try it out and see if you can figure out what my addition accomplished. :wink: Nice form, btw.

thanks for the info…yes, i had noticed I forgot the last “else” down below in the if statement. I have also correctly fixed the reset and submit button. I just need to get the email checker system working. thanks for your help!!

So if something in the form is invalid, you set “emailStatus” to a certain error message. Where is this emailStatus going to be displayed? I can’t find it in your .fla.

How about something like this? (see attachment)