Hi,
I am working on a contact form and I need you to help me add script to this so
users can only send mail if they fill all the fields
Below you can see the as lines I'm using
[code]
rec="cipiclaudiu@yahoo.com";
serv="php";
var fields_descriptions= Array ("",
Array("t1", "your_name", "Your Name:"),
Array("t1", "your_phone", "Phone:"),
Array("t2", "your_email", "Your Email:"),
Array("t3", "subject", "Subject:"),
Array("t4", "message", "Message:"),
Array("t5", "field_2", "E-mail:"),
Array("t6", "field_3", "Address:"),
Array("t7", "field_4", "fax:")
);
for (i=1; i<=fields_descriptions.length; i++) {
this["k"+i].text=fields_descriptions[i][2];
}
[/code]
jon gibbons - 01 Jul 2008 10:13 GMT
This works
You will have to drag an "Alert Component onto the stage:
import mx.controls.*;
// when the submit button is clicked, send the form values to the server using
a LoadVars object.
var postBtnListener:Object = new Object();
postBtnListener.click = function(evt:Object) {
// if the name is blank, display an error message using the Alert component.
if (your_name.text.length == 0) {
Selection.setFocus(Forename1);
Alert.show("Please enter your Your Name.", "Error", Alert.OK);
return false;
}
if (your_phone.text.length == 0) {
Selection.setFocus(Surname1);
Alert.show("Please enter your Phone Number.", "Error", Alert.OK);
return false;
}
if (your_email.text.length == 0) {
Selection.setFocus(Address1);
Alert.show("Please enter your E Mail Address.", "Error", Alert.OK);
return false;
}
and so on:
send_lv.onLoad = function(success:Boolean) {
// if the comments were sent to the server and you received a response, clear
the form fields and display an Alert message.
if (success) {
your_name.text = "";
your_phone.text = "";
your_email.text = "";
Alert.show("Thank you for your Booking.An E Mail has been sent to your E Mail
Address Box.", "Success", Alert.OK);
} else {
// else you encountered an error while submitting to the server.
Alert.show("Unable to process your comments at this time.", "Server Error",
Alert.OK);
}
};
CipiClaudiu - 01 Jul 2008 10:36 GMT
Thank You for writing.
I have to say this is not ... maybe I haven't placed it right ..
Here you can see the contact form structure
http://4webdesign.biz/temp/vinod/test/ascontact.html
Note! the submit button is having as on it.
Feel free to decompile the swf to take a better look at it.
I will apreciate it if you'd help me .. I really need help with this
__smileHare - 01 Jul 2008 11:27 GMT
I thought 2F was writing on AS3.
You have to use a LoadVars to connect a ASP/PHP file, and let the ASP/PHP file request variables from your SWF, then sends mails by the file.
CipiClaudiu - 01 Jul 2008 13:14 GMT
well, it is connected to asp and php files .... things is this contact form I
bought over the internet and since I'm not good with programming I tought
someone might be able to help me with this.
So form what I understand, the php file should control the swf file to check
the empty fields?