[font=Times New Roman][size=3]The validation of this form is working for me. My question is when all the fields are valid how can I send the form my php ? [/size][/font]
[font=Times New Roman][size=3]MX Pro 2004[/size][/font]
//validate fourm
submit_btn.onRelease = function(){
name_field.text.isEmpty("name",4);
name_field.text.isEmail();
message_field.text.isEmpty("message",10);
}
String.prototype.isEmpty = function(field,min_chars){
var str = this;
if(this == ""){
feedback =("Please fill in the " + field +" field");
return false;
}
else if(this.length < min_chars){
feedback =("The "+ field +" you entered is invalid - not enough characters.");
return false;
}
return true;
}
String.prototype.isEmail = function(){
var invalid_message = "Invalid email address";
var str = this;
var req_chars = new Array("@",".");
var bad_chars = new Array();
if(!(this.isEmpty("email",6))){
return false;
}
for(i=0;i<200;i++){
if((i>=33 && i<=45) || i == 47 || (i>=58 && i<=63) || (i>91 && i<=96)
|| (i>=123 && i<=126) || (i>=161 && i<=199)){
var char = String.fromCharCode(i);
bad_chars.push(char);
}
}
for(i=0;i<bad_chars.length;i++){
if(str.indexOf(bad_chars*) != -1){
var char = bad_chars*;
feedback =(invalid_message);
return false;
}
}
for(i=0;i<req_chars.length;i++){
if(str.indexOf(req_chars*) != -1){
index = str.indexOf(req_chars*);
if(str.indexOf(req_chars*,(index+1)) != -1 && req_chars* != "."){
feedback =(invalid_message);
return false;
}
}
else{
feedback =(invalid_message);
return false;
}
}
return true;
}
Before I validated the form I had the following on my submit button and it worked fine. But now I need an alternitive.
on (release) {
this.loadVariables(“emailChris.php”, “POST”);
}
I’m fairly new to AS. I would be greatful for any help.
Scotti