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
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!
Hey thnks stwingy, I will try that out Cheers, AEREA
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.
I`ll have a look Aer fatcontroller@gifsrus.com Certified but not by Macromedia!
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!
Hey stw, Thanks for your help, but it still works when writing the email address with spaces in between. Do you have another idea?
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!
Hey stwingy! It works perfectly! Macromedia: you have to certify this guy 'cause he knows what he's talking about Thanks stw, Cheers.
you are welcome Aer. Certified but not by Macromedia!
Don't see what you're looking for? Try a search.
|