all groups > flash (macromedia) > january 2004 >
You're in the

flash (macromedia)

group:

Contactform with false data


Contactform with false data AEREA
1/3/2004 8:04:38 PM
flash (macromedia):

Hello Everyone,
There are several ways for costumers to contact you via swf files. But I haven't seen a swf that returns error messages when writing your e-mail address with spaces in between like:
youraddress here@yourdomain.com
The actionscript only requests that you fill the input text box with an @ and a dot, so if I'm not wrong there's no way to know if the costumer pressed the spacebar while writing their e-mail address.
Also you can't restrict the use of Upcase characters while writing it.

Please let me know if there's a way to restrict the use of the spacebar as upcase characters in swf files.

Thanks in advance and Happy New Year to everyone.

AEREA

Re: Contactform with false data stwingy
1/4/2004 2:56:43 AM
something like this should work,
//button with instance name mybutton
//textfieldlabelled mytext
//on the frame

Mybutton.onPress = function() {
myvar = mytext.text;
for (i=0; i<myvar.length; i++) {
if (myvar.charAt(i) != " ") {
myothervar += myvar.charAt(i);
}
}
mytothervar = myothervar.toLowerCase();
trace(mytothervar);
};

Certified but not by Macromedia!
Re: Contactform with false data AEREA
1/4/2004 3:03:46 AM

Hey thnks stwingy,
I will try that out

Cheers,
AEREA

Re: Contactform with false data AEREA
1/4/2004 3:18:48 AM

Hey stw,

I was wondering if you could be so kind to check my file, so it can give you a better idea of what I'm looking for.

Thnks.


Re: Contactform with false data AEREA
1/4/2004 3:22:12 AM


I duno why it didn't upload

here you go

http://webforums.macromedia.com/attachments/contacform.zip


Re: Contactform with false data stwingy
1/4/2004 3:23:25 AM
I`ll have a look Aer
fatcontroller@gifsrus.com


Certified but not by Macromedia!
Re: Contactform with false data stwingy
1/4/2004 3:51:01 AM
Try changing your code on the form mc to this

fscommand("allowscale", "false");
//
// set some variables
//
mailform = "mailform.php";
confirm = "THANK YOU, A CONFIRMATION EMAIL HAS BEEN SENT TO YOUR EMAIL ADDRESS.";
action = "send";
error1 = "VALID EMAIL REQUIRED";
error2 = "INPUT REQUIRED";
//
// and focus on variable fname
//
Selection.setFocus("name");
//
// validate email function
//
function validate(address) {
if (address.length>=7) {
if (address.indexOf("@")>0) {
if ((address.indexOf("@")+2)<address.lastIndexOf(".")) {
if (address.lastIndexOf(".")<(address.length-2)) {
return (true);
}
}
}
}
return (false);
}
//
// form check
//
function supercheck() {
for (i=0; i<email.length; i++) {
if (email.charAt(i) != " ") {
myothervar += email.charAt(i);
}
}
email = myothervar.toLowerCase();
trace(email);
}
function formcheck() {
supercheck();
if ((((email == null)) || (email.length<1)) || (email == "VALID EMAIL REQUIRED")) {
email = error1;
action = "";
}
if (!validate(email)) {
email = error1;
action = "";
}
if ((name == null) || (name == "")) {
name = error2;
action = "";
}
if ((comments == null) || (comments == "")) {
comments = error2;
action = "";
}
if ((validate(email)) && (email != error1) && (name != "") && (name != error2) && (comments != "") && (comments != error2)) {
action = "send";
loadVariablesNum(mailform, 0, "POST");
gotoAndPlay("wait");
}
}
stop();

Certified but not by Macromedia!
Re: Contactform with false data AEREA
1/4/2004 4:59:38 AM

Hey stw,

Thanks for your help, but it still works when writing the email address with spaces in between. Do you have another idea?



Re: Contactform with false data stwingy
1/4/2004 12:07:40 PM
I just wrote the code into mine at it works ok, try writing it directly in your formcheck function

something like

function formcheck() {
for (i=0; i<email.length; i++) {
if (email.charAt(i) == " ") {
email = error1;
action = "";
}
}
if ((((email == null)) || (email.length<1)) || (email == "VALID EMAIL REQUIRED")) {
email = error1;
action = "";
}
if (!validate(email)) {
email = error1;
action = "";
}
if ((name == null) || (name == "")) {
name = error2;
action = "";
}
if ((comments == null) || (comments == "")) {
comments = error2;
action = "";
}
if ((validate(email)) && (email != error1) && (name != "") && (name != error2) && (comments != "") && (comments != error2)) {
email = email.toLowerCase();
action = "send";
loadVariablesNum(mailform, 0, "POST");
trace(email);
gotoAndPlay("wait");
}
}


If that does not work,I`ll send you my fla.

Certified but not by Macromedia!
Re: Contactform with false data AEREA
1/4/2004 9:28:59 PM

Hey stwingy!

It works perfectly!
Macromedia: you have to certify this guy 'cause he knows what he's talking about

Thanks stw,
Cheers.


Re: Contactform with false data stwingy
1/5/2004 1:22:37 AM
you are welcome Aer.


Certified but not by Macromedia!
AddThis Social Bookmark Button