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

Send a form from swf 1

Status
Not open for further replies.

247138

Programmer
Jul 3, 2005
32
RO
I need to send my contact form wich consists on 6 separate boxes with input text. I also have the 2 buttons: reset & submit I used the script provided by CMD 83 for purexenon [on key frame 1:
(depending on mailform you're using)
(on a keyframe)
USER = "your@email.com";
SUBJECT = "subject of the mail";
LINK = "stop();

here you also make the form with var: varname
(so this appears in your mailbox)

on the submit button:

go to and play frame 2
here on a keyframe:
getURL(" "_blank", "POST");
stop();

put a thank you or sending... on this frame if you like

the person will get a pop-up with whatever you put on
(this is the mailform from my provider, adjust if you have your own)] {here it's the entire messege, but i used it like he said}
but it doesn't work. on clicking "submit" another page opens [in my browser] with this adress:


and the messege:

tlx_EmailTo Must Be A Valid Email Address

What did I do wrong?
PLS HEEEELP !!!!!
I'm a donkey on the edge!!!!!!

:))))
 
again, what are each of the the input boxes for? (name, email, ...)
 
inputBox 1: name
~~~~~~~~ 2: company
~~~~~~~~ 3: e-mail
~~~~~~~~ 4: adress
~~~~~~~~ 5: tel/fax
~~~~~~~~ 6: message
Then: [under teh boxes] button left: clear form
button right:send form
It's a bussines site. I want people to write info about themselves, then a message and sendit to my mailRecipient
Thanks 4 the interes
 
ok you're gonna need to make 3 keyframes

on the first keyframe, give each input box these instance names:
================
1. name_txt
2. company_txt
3. email_txt
4. address_txt
5. telfax_txt
6. message_txt

reset = reset_btn
submit = submit_btn
==================
make an empty actions layer and put this code on that layer in the 1st keyframe :
=================
Code:
stop();
[COLOR=gray]//actions for reset button[/color]
reset_btn.onRelease = function() {
	
	[COLOR=gray]//sets each button blank[/color]
	name_txt.text = "";
	company_txt.text = "";
	email_txt.text = "";
	address_txt.text = "";
	telfax_txt.text = "";
	message_txt.text = "";
};

[COLOR=gray]//actions for submit button[/color]
submit_btn.onRelease = function() {
	
	[COLOR=gray]//import variables from each input box[/color]
	sender_mail = _root.email_txt.text;
	sender_name = _root.name_txt.text;
	company = "<br> Company: "+_root.company_txt.text;
	address = "<br> Address: "+_root.address_txt.text;
	telfax = "<br> Tel/Fax=: "+_root.telfax_txt.text;
	message1 = "<br> Message=: "+_root.message_txt.text;
	
	[COLOR=gray]//format for the subject[/color]
	sender_subject = "Contact: "+sender_name;
	
	[COLOR=gray]//format for the message[/color]
	sender_message = "User submitted message: <br> Name: "+sender_name+"<br> Email: "+ sender_mail + company + address + telfax + message1;
	
	[COLOR=gray]//load variables to the php file[/color]
	loadVariables("sendmail.php", this, "POST");
	
	[COLOR=gray]//check to see if everything went A-OK[/color]
	this.onData = function() {
		_root.nextFrame();
		if (this.output == 'error') {
			_root.gotoAndStop("error");
		} else {
			_root.gotoAndStop("success");
		}
	};
};


[COLOR=gray]//this is to make sure all the fields have been entered[/color]
k = new Object();

[COLOR=gray]//onKeyUp calls this function each time a key is pressed[/color]
k.onKeyUp = function() {
	
	[COLOR=gray]//checks if any fields are blank[/color]
		if (_root.name_txt.text != ''
		&& _root.company_txt.text != ''
		&& _root.email_txt.text != ''
		&& _root.address_txt.text != ''
		&& _root.tel/fax_txt.text != ''
		&& _root.message_txt.text != '') {
		
		[COLOR=gray]//enables the submit button[/color]
		_root.submit_btn.enabled = true;
	} else {
		
		[COLOR=gray]//disables the submit button[/color]
		_root.submit_btn.enabled = false;
	}
};

[COLOR=gray]//this listener keeps checking the status of the onKeyUp[/color]
Key.addListener(k);

[COLOR=gray]//the button must start out disabled[/color]
_root.submit_btn.enabled = false;

===================================================
ok keyframe #1 is done

i know this is alot so when you get all this done (dont try testing, it wont work) tell me and i'll give you the rest
 
It's done. I'll wait for the next...
Thank you.
 
The next two keyframes are the success/failure ones
On keyframe #2, name it "success" (from the property inspector) and remove the input boxes and buttons. Create a static textbox and put your own "message successfully sent" message in its place.

On keyframe #3, name it "error" and put your "message error" message in another static textbox in place of the textboxes and buttons.

Put a stop(); action on each keyframe (you don't need any other actions on these keyframes).

Now to download the sendmail.php file. I have uploaded the file here (download and unzip). The file is set so you dont have to change anything in it. Just upload it to the same directory as your swf file.

One more thing. Go back to your first keyframe and find this code:

Code:
    [COLOR=gray]//import variables from each input box[/color]
    sender_mail = _root.email_txt.text;
    [highlight]sender_name = _root.name_txt.text[/highlight];

and put this code underneath:

Code:
    user_email = "your@email.com" [COLOR=gray]//change to your real email[/color]
Obviously you're going to need to change that to your email!

Now just upload the swf and php files to your website and your done!

Ive tried this all myself, so if anything doesn't work, feel free to upload your .fla to your site and I'll have a look at it.
[peace
]
 
What if I needed to add a dropdown(option) menu and/or checkboxes/radio buttons? can these also be added to this?
 
Absolutely!

Just assign each component's value to a variable when the submit button is clicked, and then add on this variable with a (+) to the
Code:
sender_message = "User submitted message:...
line. (The sender_message variable defines what goes in the body of the email send to you. Therefore, as long as the name "sender_message" is retained, this line is perfectly customizable)
 
benny2168,
is it ok if i direct u to my ftp?
you'l find the fla there. OK.
Thank you.
By the way... It's not working.

86.105.11.135
useName: user107
password: coolnite

Thank you
 
shame on me. But no. Actually, upload it... where? Sorry. I may seem dumb, but... So, if you have enough patience:
ftp://86.105.11.135
with username:
user107
password:
coolnite.

If you it's not working, try ovidiuleo on YM. Thank you
 
Not good. Stop. The path is?
ftp://86.105.11.135-clax 2000.clax.fla
Trz now
 
hmm what version of flash do you have?
it doesnt seem to want to open on my computer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top