Form Field Validation, Specially Email Field. Any Ideas?
Hi. I have a simple flash form designed for my website i have all things done but i am not getting the idea how to validate the "Email" field like you validate it in JavaScript for an "@" and a "." to be present in the finally submitted form. I need to do it in ActionScript as the other form validation is done in it as well. Please let me know if you can help. Thanks
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 09-11-2004, 12:25 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Form Field Validation, Specially Email Field. Any
Hi. I have a simple flash form designed for my website i have all things done but i am not getting the idea how to validate the "Email" field like you validate it in JavaScript for an "@" and a "." to be present in the finally submitted form. I need to do it in ActionScript as the other form validation is done in it as well. Please let me know if you can help. Thanks
Flash 4 Form Validation For Email Field
I guess i can only hope there is still someone around knowing this or that on Flash 4 form fields validation.
I have this:
On (Release)
If (FirstName eq "")
Go to and Stop (2)
Else If (Email eq "")
Go to and Stop (3)
Else If (ToSubject eq "")
Go to and Stop (4)
Else If (Description eq "")
Go to and Stop (5)
Else If (ToComments eq "")
Go to and Stop (6)
Else
Load Variables ("12php/0MailPHP.php", 1, vars=POST)
Go to and Stop (7)
End If
End On
And of course, the problem is the email field.
as is it only checks if anything has been entered, which is not enough, it should check for the @ and the . at least - i just don't know how to do this with Flash 4, any hints are welcome really........
(i got rid of MX for reasons i am not even sure anymore, just always preferred to work with 4)
Form Field Validation And ASP
Hello
I have a simple Flash contact form with name,email, message, etc fields and would like ASP - not Flash - to validate the fields. So if a site visitor completes the form and presses 'submit' while having omitted the @ sign, for example, from his email address, then ASP would tell Flash to display something like 'Please complete the email address field'.
I have some ASP (VB Script) which does this, but how do I pass it to Flash, and how would I get Flash to display it in a simple dynamic text box next to the form? And what happens if more than one field has been incorrectly completed?
Many thanks for any help.
_Postman
_form Validation - Checking Valid Email Field
I am trying to validate a form for a valid email address, but this doesnt seem to work. can anyone see where I am going wrong.
Variable name is Email. If I give it an instance name of Email aswell, it stops the form from being successful, but puts the variable path in the input box when the movie loads. Shouldnt need the instance name though i know
on (release) {
if (!Email.length || Email.indexOf ("@") == -1 || Email.indexOf (".") == -1) {
gotoAndPlay("sending");
} else {
formerror = "please enter a valid email address";
}
}
thanks
Problem With Validation: Newsletter Subscription Email Field...
Hi,
Ususally when I put in a regular contact form in Flash (you know, name, email and message), I use Senocular's tutorial and have the validation on Name as req. field and syntax of Email field and it always works great.
Now I have this form consisting of just an Email field and a Submit button. The filled-in address is supposed to be added to an external database from a paid newsletter service. Their requirements are: - a specific var. name for the field and the action url where the submitted info is processed to their clients database so to speak, so I have to open that page in order for the input to be processed (in a new window).
When I put this on the submit button:
Code:
on (release) {
loadVariablesNum ("http://www.ymlp.com/subscribe.php?clientsname", "_blank", "POST");
gotoAndStop("thanks");
}
it works. But no validation on the filled-in address, so the external page gives an error with anything that's not an email address.
(in url: real client's accountname substituted here for 'clientsname')
So I put this on the button:
Code:
on (release) {
formcheck ();
}
And this in an actionframe a layer above (email is the instance name of the field, and its var name is YMLP0):
Code:
action = "send";
function validate (email) {
if (email.length>=7) {
if (email.indexOf("@")>0) {
if ((email.indexOf("@")+2)<email.lastIndexOf(".")) {
if (email.lastIndexOf(".")<(email.length-2)) {
return (true);
}
}
}
}
return (false);
}
function formcheck () {
if ((((email == null)) || (email.length<1)) || (email == "No valid email address")) {
email = "No valid email address";
action = "";
}
if (!validate (email)) {
email = "No valid email address";
action = "";
}
if ((validate (email)) && (email != "ERROR!")) {
action = "send";
loadVariablesNum ("http://www.ymlp.com/subscribe.php?clientsname", "_blank", "POST");
gotoAndStop("thanks");
}
}
But it doesn't do anything.
Can anyone point me in the right direction? I'm really no scripter, just a designer I'm afraid .
Many thanks.
Form Field Validation Troubles
Can someone please tell me what is wrong with this code!
I have a simple mailto form in my movie. I am trying to validate 3 form fields. If there is information in all 3, it passes the info to my external php file. If one or more fields is empty I want it to go to my invalid frame and tell the user to fill the required fields, etc. What's happening is that it's not validating, even if no fields are filled out it passes the null information to my php doc and sends me an empty e-mail. Here is the AS that I have on the submit button for the form:
on (release){
if (name_field != "" && email_field != "" && phone_field != "")
{
loadVariablesNum("scripts/thanks.php", 0, "POST");
gotoAndPlay("valid");
}
else
{
gotoAndPlay("invalid");
}
}
It seems like this should work? Any ideas are greatly appreciated!
Code For CC Field In Email Form?
Hello all,
I'm making a simple form that will generate an email in Outlook with the info you filed out.
Here is the code:
email = "";
mailto = "mailto:" add name add "<" add email add ">";
name = "Enter Name";
subject = "Subject of Email";
However, I also want to define who the email will go to in the CC. Anyone know how to do this?
I imagine its pretty simple but i can't get it to work for some reason.
Thanks in advance,
S.
Form Submit Problems Not Email Field?
I tested the form and it works fine except for the email address which is not being sent from the form. There are no errors when I submit or when I check the syntax in Flash c3.
I do notice in the aciton script window all of hte variables name and cooments are blue bu the email is just black.
I am a beginner learning flash and I used a video tutorial form lynda.com I notice in the tutorial it was also balck but hey did not test it.
What to do??
Attach Code
var address:String = "../cgi-bin/formmail.pl";
var url:URLRequest;
var variables:URLVariables = new URLVariables();
variables.subject = "Information Request";
variables.recipient = "invtech@drmammano.com";
function sendForm(event:MouseEvent):void
{
variables.name = name_txt.text;
variables.email = email_txt.text;
variables.comments = comments_txt.text;
url = new URLRequest(address);
url.method = URLRequestMethod.POST;
url.data = variables;
navigateToURL(url);
}
submit_btn.addEventListener(MouseEvent.CLICK, sendForm);
Line Breaks In Email Form Field
Hi,
I don't know if you'll be able to help me with this or not, but here's my problem.
I've been using a Perl "form to email" script that works just fine using html forms. Now I've created a Flash form and I'm using the same script to process it, and everything is working hunky dory except for the "message" area which is a multiline text field. When filling out the form, it wraps properly and I can create line breaks with the Enter key, but when it comes through to my mail, the message area has lost those line breaks. The rest of the fields are separated by line breaks, so it's something with this message area that's not recognized the same as a <textarea>. I'm wondering if this an issue with the script or with Flash? As I said, a normal html <textarea> comes through formatted with line breaks just fine.
Does anyone have a suggestion about this?
Thanks very much,
Trouble Passing Form Field Data To Asp Email
Hello all,
I am building an form in an AS3 swf which I'd like to validate and send form feild data to an asp server side file (order.asp) which will send the info via email. The swf will validate the data, but not send the data to asp.
I have a test form working in html to validate the asp, but I need to have it work from the AS3 swf. The code that I am using is posted below. Any help would be greatly appreciated!
stop();
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
// ----------------------------------------------------------------
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("order.asp");
var varLoader:URLLoader = new URLLoader;
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
status_txt.text = "";
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
function ValidateAndSend(event:MouseEvent):void{
//validate form fields
if(!yn1.length) {
status_txt.text= "Please answer .1";
} else if(!yn2.length) {
status_txt.text = "Please answer .2";
} else if(!yn3.length) {
status_txt.text = "Please answer .3";
} else if(!yn4.length) {
status_txt.htmlText = "Please answer .4";
} else if(!yn5.length) {
status_txt.text = "Please answer .5";
} else if(!yn6.length) {
status_txt.text = "Please answer .6";
} else if(!yn7.length) {
status_txt.text = "Please answer .7";
} else if(!yn8.length) {
status_txt.text = "Please answer .8";
} else if(!dm.length) {
status_txt.text = "Please enter the month of your birth";
} else if(!dd.length) {
status_txt.text = "Please enter the day of your birth";
} else if(!dy.length) {
status_txt.text = "Please enter the year of your birth";
} else if(!acc_name.length) {
status_txt.text = "Please enter the name as it appears on your account.";
} else if(!phone.length) {
status_txt.text = "Please enter your phone number";
} else if(!address1.length) {
status_txt.text = "Please enter your mailing address";
} else if(!state1.length) {
status_txt.text = "Please enter your state";
} else if(!zip.length) {
status_txt.text = "Please enter your zip code";
} else if(!validateEmail(email.text)) {
status_txt.text = "Please enter a VALID email address";
} else if(!bank_name.length) {
status_txt.text = "Please enter the name of your bank.";
} else if(!bank_address.length) {
status_txt.text = "Please enter the address of your bank";
} else if(!check_number.length) {
status_txt.text = "Please enter a number";
} else if(!bank_state.length) {
status_txt.text = "Please enter in what state your bank is located";
} else if(!bank_zip.length) {
status_txt.text = "Please enter the zip code for your bank";
} else if(!routing_number.length) {
status_txt.text = "Please enter your routing number (located in the bottom left of your check)";
} else if(!account_number.length) {
status_txt.text = "Please enter your bank account number";
} else {
status_txt.text = "Your Order has been processed, you will be contacted for vailidation purposes... " + acc_name.text + ", your order has been sent!";
gotoAndStop(2);
}
}
function validateEmail(str:String):Boolean {
var pattern:RegExp = /(w|[_.-])+@((w|-)+.)+w{2,4}+/;
var result:Object = pattern.exec(str);
if(result == null) {
return false;
}
return true;
}
Input Field Validation
I am using Flash MX and I am designing a form.
How do I validate input values that the user may enter.
For example if the user inputs a letter in a Telephone number field?
Input Field Validation
Hi,
I want create an input text field can only input EVEN numbers and do nothing when input other characters.
What codes I've to put in the button?
Help please.
Chris
Input Field Validation
Hi,
I want create an input text field can only input EVEN numbers and do nothing when input other characters.
What codes I've to put in the button?
Help please.
Chris
Send Email From "input Text Field" Or Form...HElp
I'm trying to figure out how to send email without launching a
composition window (from an email client). I've gone through some
tech notes on macromedia.com, but can't find what I'm looking for!
I have an "input text field" and "send" button. I want the user to be able
to enter their email address and click the button to send the info without
launching another window or app. I know it's probably a Variable thing...
I've tried and can't get it to work. Any ideas would be really appreciated.
Thanx!
[Edited by dsprouls on 08-09-2001 at 03:13 AM]
Simple Text Field Validation
I am trying to create a simple text field validation to make sure a user types in a particular string before the movie will go on to the next action when the press the continue button.
What am I doing wrong here - my script does not advance to next_movie.swf nor does it play the invalid frame no matter what I type in TextField2:
on (release) {
if (TextField2="sample text") {
loadMovieNum ("next_movie.swf", 0);
} else {
gotoAndStop ("invalid");
}
}
I have tried the == operand and also an else if statement to no avail
Why Is This Text Field Validation Failing
The script below is supposed to validate that each field in a flash form contains data, if not the user is prompted to enter the relevant information, however the script always continues to the end even if check="notok". I put a breakpoint at the If(check == "ok") line and the prompts appear in the text fields OK, but the script will not wait for the user to complete the form.
on (release)
{
check = "ok";
//Now import the variables we
//need to send in this movie clip
if(Semail.text != "" and check == "ok")
{
sender_mail = Semail.text;
}
else
{
check = "notok";
focusManager.setFocus(Semail);
Semail.text = "Please input your email!";
}
if(Sname.text != "" and check == "ok")
{
sender_name = Sname.text;
}
else
{
check = "notok";
focusManager.setFocus(Sname);
Sname.text = "Please input your name!";
}
if(Ssubject.text != "" and check == "ok")
{
sender_subject = Ssubject.text;
}
else
{
check = "notok";
focusManager.setFocus(Ssubject);
Ssubject.text = "Please enter a subject!";
}
if(Smessage.text != "" and check == "ok")
{
sender_message = Smessage.text;
}
else
{
check = "notok";
focusManager.setFocus(Smessage);
Smessage.text = "Please enter a message!";
}
If(check == "ok")
{
//all the vars we just imported
//will be sent via POST method now
loadVariables("sendmail.php", this, "POST");
this.onData = function()
{
for (var a in this)
{
trace([a, this[a]]);
}
//ok, next frame
_root.nextFrame();
}
Sname = '';
Semail = '';
Smessage = '';
Ssubject = '';
}
}
Text Field Data Validation
I have placed two input text field and I am inserting some values dynamically through those fields. Now I need to validate those field as string with no special character and number..and another one should be valid by number only. Suggestion and Ideas please.
Email Form Validation
I have this code in my email flash file and its working ok.
But i want to make sure that nobody with mail domains online.no or frisurf.no can register their mail adress in the input text field "domene" and i wan to have a message saying so if they try to register it.
The input text field "domene" only returns a mesage when its "null"
if (domene == null) {
domene = "Må fylles ut";
action = "";
}
Hope somebody can help me with this!?
Cheers
Retro...
-----------------Code------------------------------------
//
// validate email function
//
function validate (address) {
if (address.length>=5) {
if (address.indexOf("@")>0) {
if ((address.indexOf("@")+2)<address.lastIndexOf(".") ) {
if (address.lastIndexOf(".")<(address.length-2)) {
return (true);
}
}
}
}
return (false);
}
//
// form check
//
function formcheck () {
if ((((email == null)) || (email.length<1)) || (email == "Adressen er ikke gyldig")) {
email = "Adressen er ikke gyldig";
action = "";
}
if (!validate(email)) {
email = "Adressen er ikke gyldig";
action = "";
}
if (fname == null) {
fname = "Må fylles ut";
action = "";
}
if (lname == null) {
lname = "Må fylles ut";
action = "";
}
if (firma == null) {
firma = "Må fylles ut";
action = "";
}
if (org == null) {
org = "Må fylles ut";
action = "";
}
if (addy1 == null) {
addy1 = "Må fylles ut";
action = "";
}
if (zipp1 == null) {
zipp1 = "Må fylles ut";
action = "";
}
if (cityp1 == null) {
cityp1 = "Må fylles ut";
action = "";
}
if (ss == null) {
ss = "Må fylles ut";
action = "";
}
if (antall == null) {
antall = "Må fylles ut";
action = "";
}
if (domene == null) {
domene = "Må fylles ut";
action = "";
}
if ((validate(email)) && (email != "Feil!") && (fname != "") && (lname != "")) {
action = "send";
loadVariablesNum (mailform, 0, "POST");
gotoAndPlay ("wait");
}
}
stop ();
-=email And Form Validation [help]=-
Im looking for a better method then using this current setup as it doesnt work correctly.
can someone show me a bette script or a place to read about better form validation
Quote:
on (release) {
if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
_root.FormStatus = "Please enter your email address correctly";
}
else if (!FirstName.length) {
_root.FormStatus = "Please enter your first name.";
}
else if (!Surname.length) {
_root.FormStatus = "Please enter your surname.";
}
else if (!Phone.length) {
_root.FormStatus = "Please enter your phone number";
}
else {
loadVariablesNum ("process_data.php", "0", "Post");
_root.FormStatus = "Sending your information..standby";
}
}
Numeric Input Text Field Validation
I have a very simple form with 2 input text fields. The user enters numbers into the two text fields and with the click of a button, the two numbers are divided and then displayed in a dynamic text field. That's working.
What I want to do is validate that the values in the input text fields are actually numerical and not alphanumeric. How can I do this?
Also, I want to make sure that the user enters values into both fields. If they don't, a warning will appear and a dynamic text field in the warning will show the warning for this kind of error as well as an error for the datatype.
How can I do this?
UPDATE: I found a way to make sure the user enters numerical data:
textinput.restrict = "0-9";
Email Validation On Simple Form
I am sure this is trivial to most, however, I am struggling. I have a simple form on which I am trying to add very basic email verification otherwise it is possible for a user to send me rubbish that appears to come from a non existent mailbox at my domain. I have changed the action script to the one below but keep getting the fault shown
submit_btn.onRelease = function() {
if (!email_txt.length || email_txt.indexOf("@") == -1 || email_txt.indexOf(".") == -1) {
status_txt.text = "Invalid Email.";
} else if (!subject_txt.length) {
status_txt.text = "Missing Subject";
} else if (!message_txt.length) {
status_txt.text = "Missing Message";
} else {
loadVariablesNum("form.php", 0, "POST");
name = "Full Name:";
email = "Email address:";
message = "thank you, your message has been sent";
}
}
The error I get is as follows;
**Error** Symbol=Symbol 39 FORM, layer=Symbol 38, frame=1:Line 1: Statement must appear within on handler
submit_btn.onRelease = function() {
Total ActionScript Errors: 1 Reported Errors: 1
As far as I am aware, the layout is right and I just don't no what to do next.
Can somebody please help, if it's not obvious, I am very new at this!!
Email Form Validation Code
thought i would post this request here as well since its from the tutorial found here.
I adapted this from another code (layout galaxy) . the problem is that the error field is not reporting errors when data is passed through the form.
here is the code that is on the first frame of actions layer :
Code:
stop();
// Making the default setting for below mentioned textfields
name = "";
email = "";
message = "";
//
//-------------------------------------------------------
// Submit Button action
send.onRelease = function() {
//Add Path of the php file
feedbackpath = "mailto.php";
//
str1 = email.indexOf("@");
str2 = email.indexOf("@")+1;
str3 = email.charAt(str1+1);
str4 = email.lastIndexOf(".");
str5 = email.charAt(str4+1);
len = length(email);
counter = 1;
flag = 0;
while (Number(counter)<=Number(len)) {
Char = substring(email, counter, 1);
if (Char ne "@") {
flag = Number(flag)+1;
}
counter = Number(counter)+1;
}
//
//Name field validation
if (name == "") {
condition1 = "";
error = "Please Enter Your Name";
} else {
condition1 = "ok";
error = "";
}
//E-Mail Address validation
if (str4<=str2 || str3 == "." || str5 == "" || Number(flag) != Number(len-1)) {
condition2 = "";
error = "Please Enter A Valid Email";
} else {
condition2 = "ok";
error = "";
}
//message field validation
if (message == "") {
condition3 = "";
error = "Please Include Your Message";
} else {
condition3 = "ok";
error = "";
}
//Sending data to php file only if all the above validations are fulfilled
if (condition1 == "ok" && condition2 == "ok" && condition3 == "ok") {
loadVariablesNum(feedbackpath+"?name="+name+"&email="+email+"&feedback="+suggestion, 0);
gotoAndStop(2);
}
};
//
//-------------------------------------------------------
// Reset Button action
reset.onRelease = function() {
// Making the default setting for below mentioned textfields
name = "";
email = "";
message = "";
};
and the .fla is included too.
thanks.
EDIT : now i can receive Errors for the message filed, but still nothing if Email or name is incorrectly entered.
FULL Email Validation FORM Help
Hi all i have an email validation script here with all validations but have just come accross one i missed
the script will allow
me.you@yours.com
but not
me.111@yours.com
inother words it wont allow numbers after the "dot" please help
Flash MX: Email Form Validation
Actionscript query for Flash MX
Can anyone help me?
At the moment I have a script which checks the Email field isn't empty, and if it is puts the text 'Enter a valid email' in to prompt the user on submit:
on (release) {
if ((Email == null) || (Email == "Enter a valid email")){
Email = "Enter a valid email";
testEmail = 0;
} else {
testEmail = 1;
}
if (testEmail == 1){
loadVariablesNum("/cgi-bin/sendmail.asp", 0, "POST");
gotoAndPlay("valid");
} else {
gotoAndPlay("invalid");
}
}
...and it works fine.
But I want to check the Email address is valid:
if ((Email == null) || (Email == "Enter a valid email") || (Email !contain an '@' sign and a '.')){
Email = "Enter a valid email";
testEmail = 0;
} else {
testEmail = 1;
Can anyone help?
Also how do I stop Flash sending the 'testEmail' variable to the asp form?
Cheers in advance
Gaz
Email Form Validation-Flash 8 Professional
I have been looking at this too long now! I need to ask for help.
I have a simple email form - Name-Company name-telephone-email-message
The code that I have on the send button is this:
quote:
on (press) {
// Make sure the user filled in all the required fields.
if (sender_name eq "" and sender_email eq "" and message eq "") {
// Check to make sure the email address includes and @.
i = "0";
validmail = 0;
while (Number(i)<=Number(length(sender_email))) {
if (substring(sender_email, i, 1) eq "@") {
validmail = 1;
}
i = Number(i)+1;
}
// If there's no @ in the email go to the error page.
if (Number(validmail) == 0) {
gotoAndStop("novalidmail");
} else {
gotoAndStop("ready");
}
} else {
// if the user left required fields blank, show them an error message.
gotoAndStop("ready");
}
}
I have this text appearing on a separate page for the sender to view before hitting the send button. The problem that I am encountering is that the text in the viewer's text box is as it should be but it says "undefined" throughout... I keep checking to make sure that the text boxes all have the correct Var name and they do...
Any idea why I would be getting this "undefined" throughout the text being read back?
THANKS!
Sticky Contact Form With Validation And PHP Email
I took the simple contact form from Kirupa, and added a couple of features. First I added a bit of simple validation to the Name, Email, and Message fields, to ensure that these values are supplied. After testing the form, I realized, that if I forgot to enter my email, received an error, and then hit the "back" button, I lost my entered information, which in the case of a long message, would be pretty devastating. SO, I set up some global variables that store the value of the form in the case of an error, and place it back in the form when you return to add the details you missed. What I created is essentially just a Flash version of the Sticky Form. If you wish for the PHP to work, you must enter your own email address in the source. This form is currently functioning perfectly on my employer's website, arrco.com
Feel free to pick apart my Source files, and use this form on your page.
EDIT: I just revised my conditional for the validation, to ensure that there is a character in each box, and specifically for email, that there is an @ symbol at an index higher than zero, this ensures that a valid email address has been entered, or at least faked. I have not revised my attachment to this effect, so it will have to be done manually if you wish to use it.
NEW CONDITIONAL:
if (formName.charAt(0) && formEmail.indexOf("@") > 0 && formMessage.charAt(0))
Sticky Contact Form With Validation & PHP Email 2.0
Thanks to numerous inquiries from Kirupa user joshcaple on my last Thread, I have revised the contact form considerably. The revisions involve having default text set into the form on load, instead of static labels for each field. This raised a challenge in numerous areas. The conditional for validating the form had to be revised, and a couple of built-in methods and properties of flash's text Object had to be used to clear the form onFocus and re-instate default text onKillFocus. Since there is a decent amount of scripting, I am just going to upload the source files for you to pick apart and/or use on your site. Feel free to post questions and comments, maybe we'll both learn something.
Thanks for reading!
AS3 Contact Form With Regexp Email Validation
Hi guys,
Just added a new source file to my blog . AS3 contact form.
I have also added a dropdown menu that populates a country list pulled from from an Array. This alone i found very useful to have.
Simple AS3 contact form
Advance AS3 contact form
Hope it is of some help to someone
Input Text Field Validation - Design Advice Request
Newbie here, so please be gentle.
I want to have some automatic validation of 2 input fields. One will allow integers only and another will allow decimals. I will also want to check that the numbers entered fall within a particular range. So a couple questions. First, I am trying to use OO techniques by developing classes. Should I write 2 new Classes called IntegerTextField and DecimalTextField that each subclass TextField? (If so, how should I intercept the key strokes inside these new classes so that I can check what has been entered.) Or is it better to create a new class that just holds static functions for checking fields and then call those functions as needed?
Second, does anyone have advice and/or a code snippet that demonstrates the best way to strip out non-numeric characters?
Thanks in advance for any help you gurus can provide.
AS2 - Help To Optimize Contact Form/Email Validation Code
Last edited by gadz : 2008-10-22 at 05:10.
Hi, below is how I am applying validation to my contact form, including a function to check the email syntax.
Does anyone know if it is possible to condense/optimize it?
Code:
on (release) {
function checkEmail(e) {
var i, j, l = e.length;
var foundPoint = false;
function checkChars(s, i, l) {
while (i < l && ("_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789").indexOf(s.charAt(i)) != -1) {
i++;
}
return i;
}
function checkFirstLevelDomainChars(s, i, l) {
while (i < l && ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ").indexOf(s.charAt(i)) != -1) {
i++;
}
return (i == l);
}
trace(e);
if ((i = checkChars(e, 0, l)) == 0) {
return -1;
}
j = i;
while (i < l && e.charAt(i) == ".") {
i++;
if ((j = checkChars(e, i, l)) == i) {
return -2;
}
i = j;
}
if (e.charAt(i) != "@") {
return -3;
}
do {
i = j + 1;
j = checkChars(e, i, l);
if (j == i) {
return -4;
} else if (j == e.length) {
j -= i;
if (foundPoint && j >= 2 && checkFirstLevelDomainChars(e, i, l)) {
return 1;
} else {
return -5;
}
}
foundPoint = (e.charAt(j) == ".");
} while (i < l && foundPoint);
return -6;
}
if (_parent.t1.text == "Your Name:" || checkEmail(_parent.t2.text) <> 1 || _parent.t3.text == "Telephone:" || _parent.t4.text == "Message:") {
if (_parent.t1.text == "Your Name:") {
_parent.bg1.incomplete.gotoAndPlay(2);
}
if (checkEmail(_parent.t2.text) <> 1) {
_parent.bg2.incomplete.gotoAndPlay(2);
}
if (_parent.t3.text == "Telephone:") {
_parent.bg3.incomplete.gotoAndPlay(2);
}
if (_parent.t4.text == "Message:") {
_parent.bg4.incomplete.gotoAndPlay(2);
}
} else {
_parent.message_status.text = "";
_parent.gotoAndStop("send");
}
}
Trying To Pass Text From Form Text Field To A Flash Dynamic Text Field
Hi, I was hoping someone might enlighten me as to how/if I can do this...
Currently I'm using javascript which works fine to pass text from textfield A to textfield B:
Code:
window.onload=function()
{
document.forms.form1.shirtText.value=document.forms.form1.KitGroupID_16_TextOption_38.value
}
Is there a way to pass the textfield A text to a dynamic text input (flash) as I'd like to use the font embedding flash offers. I can make it work when loading a value from a txt file but I'm not sure how to access the value identified above as KitGroupID_16_TextOption_38 and make it appear in a dynamic input box. Eventually I might want to have 3 font choices for the user but I'd like to just see if I can get this working properly first.
Your help/advice would be greatly appreciated,
-Scott
Send Email Field From Cd
HI, does any body know a way to send forms completed off a cd to an e-mail w/o having to use any server-side cgi, extentions, etc.??
jason
Enter Email Field
take a look at www.madonna.com (i know no madonna complaints, the site is well put together!!) if you go into the flash version of the site there is an enter email field that you can type your email into and once you hit enter it doesnt change the screen or take you to another place, all it does is pop up a little window saying signup successful.
can anyone suggest a tutorial that can show me how to do this? im not even concerned with the intro animation of the text field. or even the little confirmation window. just basic functionality.
Email Field In Flash
I am currently designing my website right now, and in the contact section I want to have three fields of imput that will be sent to my email. The three fields will be filled out manually by the person. Their email, Their Name, The Message. I don't really know about dynamic text fields and that stuff...so help is most appreciated. Thanks in advance -Stone6
Web Service - Email Field
How can I make an email field that hooks up to a web service? Any tutorials or help would be appreciated!
Thanx
Email Field In Flash
I am currently designing my website right now, and in the contact section I want to have three fields of imput that will be sent to my email. The three fields will be filled out manually by the person. Their email, Their Name, The Message. I don't really know about dynamic text fields and that stuff...so help is most appreciated. Thanks in advance -Stone6
Email Link With Subject Field
Hey everyone,
I was wondering if there is a way to not only make an email button but to also add the subject to the email also?
So far I am using geturl and typing in mailto:emailaddress.com but I need to add a subject field to it aswell.
Any help here would be appreciated!
Thanks.
Information From A Text Field In An Email.
Hi there,
I would like to make a text field where the user kan fill in something like an email address or name. Then when pressing a button an email is send to me with that information.
How can I make something like that.
Thanks
Checking Password And Email Field
Hi
I'm creating a form in Flash MX and I need to created a script that check if the two passwrod text intup field are the same or not, if they are the same it will go to one frame and is they don't match it will go to a diferent frame.
I need to created another script that will check if the text input field for the email has the symbol @ and .com, if this is true or false it will go to one frame or another.
Can some one tell me if this can be done on flash and if is so how can I get this to work?
Thanks
Alex
Email And Comments Input Field...
I want to create a section on my site where the viewers can enter their Email and Comments on a text field and for me to recieve the emails and comments.
Can anyone please tell me of a tutorial or book where I might be able to find this. Thanx for the help.
Email And Comments Input Field...
I need to create a "Name, Email, and Comments" field on my website. Can anyone please send me a tutorial or help on how I can do this and how I can retrieve the input information. thank you.
Including Dynamic Field In PHP Email
I have made an online configurator for a customer where they click on options which load text from an external text file into a dynamic field then at the end enter in their details into input fields. The info then needs to be emailed to us, but I can only get the input fields to be included in the email, is it possible to get the dynamic fields to all be included?
Here is the PHP Script for the email..
<?php
$to = "emailaddress@company.com";
$msg = "$name
";
$msg = "$email
";
$msg = "$telephone
";
$msg = "$suburb
";
$msg = "$comments
";
$msg = "$shape
";
mail($to, $msg, "From: Inpools Create-A-Pool
Name: $name
Email: $email
Telephone: $telephone
Suburb: $suburb
Comments: $comments
Shape: $shape
");
?>
"shape" is one of the dynamic fields and all the rest are the input fields which work fine.
Thanks
Formatting Text In Email Input Txt Field
hey there,
once again im feeling as useful as a chocolate teapot, cuz i dont get the point in formatting some input text correctly. here's the
situation:
i have an email-form on a website which allows the user to send an email to a certain adress ( obviously ). everything works out fine, but there r some characters like "ä", "ö" etc r not displayed correctly. im using php for the mail-script. can any1 tell me, what to do to get the characters displayed correctly?
as usual every help appreciated
Sending Input Field To Email Address.
I would like to have an input field in my flash document that, when text is entered and a button is then clicked, it will send that directly to my email address. I will be honest I hardly know anything about Action Script, so basically I need someone to instruct me about how I might do this. I tried looking for tutorials online, but I was unsuccesful in finding one.
thanks!
Populating The Body Field Of An Email Using Mailto:
Hi big bad world
I need to send an email from a flash projector with a pre written note in the subject and body fields... any idea how this is achieved after > getURL then mailto:me@mydomain.com ?
cheers
|