-
"Advanced" email form - grouping of textfields
Hiya.
Im a newly started flash scrub and im making a form for entering some information and sending it via PHP (flash frontend) - It currently works but lacks some functionality.
Its easy enough to get it to validate on fields and email but i need to group some of the fields into groups.
Here is a link to the form (it's in danish but will work for the example): http://vbt-as.dk/information.asp?pag...&web_version=1
You got two "groups" of fields thats getting validated for atleast some input in top and the email have to be valid.
Then you come down to the content "udkørsel" and "hjemkørsel"
There is a date, to, from and time field that will need to get grouped up.
My question is. How do i group these up so if you enter some data in "to" you will have to enter data in "date", "from" and "time" aswell but only on the line with the info you actually written (see screenshot below)
Now i dont wanna validate anything on those fields if there is no data present.
Here is my current code if that will be any assistance at all.
I know this post is very long winded but i've tried for two days to find anything about this and it's hard to find anything about it other than a regular basic email contact form.
Code:
import flash.net.URLVariables;
import flash.net.URLRequest;
import fl.controls.RadioButtonGroup;
//Tabindex
//Bestiller info
InteractiveObject(bestilinfo.mahname.getChildAt(1)).tabIndex = 1;
InteractiveObject(bestilinfo.mahsted.getChildAt(1)).tabIndex = 2;
InteractiveObject(bestilinfo.mahemail.getChildAt(1)).tabIndex = 3;
InteractiveObject(bestilinfo.mahtlf.getChildAt(1)).tabIndex = 4;
//Bruger elev info
InteractiveObject(informationcopy.mybirthdate.getChildAt(1)).tabIndex = 5;
InteractiveObject(informationcopy.myname.getChildAt(1)).tabIndex = 6;
InteractiveObject(informationcopy.myadresse.getChildAt(1)).tabIndex = 7;
InteractiveObject(informationcopy.mycity.getChildAt(1)).tabIndex = 8;
InteractiveObject(informationcopy.telefon.getChildAt(1)).tabIndex = 9;
//Udkørsel
//Linje 1
InteractiveObject(turadministration.thedate.getChildAt(1)).tabIndex = 10;
InteractiveObject(turadministration.theadresse.getChildAt(1)).tabIndex = 11;
InteractiveObject(turadministration.theadresse21.getChildAt(1)).tabIndex = 12;
InteractiveObject(turadministration.thetime.getChildAt(1)).tabIndex = 13;
//Linje 2
InteractiveObject(turadministration.thedate2.getChildAt(1)).tabIndex = 14;
InteractiveObject(turadministration.theadresse2.getChildAt(1)).tabIndex = 15;
InteractiveObject(turadministration.theadresse22.getChildAt(1)).tabIndex = 16;
InteractiveObject(turadministration.thetime2.getChildAt(1)).tabIndex = 17;
//Linje 3
InteractiveObject(turadministration.thedate3.getChildAt(1)).tabIndex = 18;
InteractiveObject(turadministration.theadresse3.getChildAt(1)).tabIndex = 19;
InteractiveObject(turadministration.theadresse23.getChildAt(1)).tabIndex = 20;
InteractiveObject(turadministration.thetime3.getChildAt(1)).tabIndex = 21;
//Linje 4
InteractiveObject(turadministration.thedate4.getChildAt(1)).tabIndex = 22;
InteractiveObject(turadministration.theadresse4.getChildAt(1)).tabIndex = 23;
InteractiveObject(turadministration.theadresse24.getChildAt(1)).tabIndex = 24;
InteractiveObject(turadministration.thetime4.getChildAt(1)).tabIndex = 25;
//Linje 5
InteractiveObject(turadministration.thedate5.getChildAt(1)).tabIndex = 26;
InteractiveObject(turadministration.theadresse5.getChildAt(1)).tabIndex = 27;
InteractiveObject(turadministration.theadresse25.getChildAt(1)).tabIndex = 28;
InteractiveObject(turadministration.thetime5.getChildAt(1)).tabIndex = 29;
//Hjemkørsel
//Linje 1
InteractiveObject(turadministration.date1.getChildAt(1)).tabIndex = 30;
InteractiveObject(turadministration.adresse1.getChildAt(1)).tabIndex = 31;
InteractiveObject(turadministration.adresse21.getChildAt(1)).tabIndex = 32;
InteractiveObject(turadministration.time1.getChildAt(1)).tabIndex = 33;
//Linje 2
InteractiveObject(turadministration.date2.getChildAt(1)).tabIndex = 34;
InteractiveObject(turadministration.adresse2.getChildAt(1)).tabIndex = 35;
InteractiveObject(turadministration.adresse22.getChildAt(1)).tabIndex = 36;
InteractiveObject(turadministration.time2.getChildAt(1)).tabIndex = 37;
//Linje 3
InteractiveObject(turadministration.date3.getChildAt(1)).tabIndex = 38;
InteractiveObject(turadministration.adresse3.getChildAt(1)).tabIndex = 39;
InteractiveObject(turadministration.adresse23.getChildAt(1)).tabIndex = 40;
InteractiveObject(turadministration.time3.getChildAt(1)).tabIndex = 41;
//Linje 4
InteractiveObject(turadministration.date4.getChildAt(1)).tabIndex = 42;
InteractiveObject(turadministration.adresse4.getChildAt(1)).tabIndex = 43;
InteractiveObject(turadministration.adresse24.getChildAt(1)).tabIndex = 44;
InteractiveObject(turadministration.time4.getChildAt(1)).tabIndex = 45;
//Linje 5
InteractiveObject(turadministration.date5.getChildAt(1)).tabIndex = 46;
InteractiveObject(turadministration.adresse5.getChildAt(1)).tabIndex = 47;
InteractiveObject(turadministration.adresse25.getChildAt(1)).tabIndex = 48;
InteractiveObject(turadministration.time5.getChildAt(1)).tabIndex = 49;
//Kommentar
InteractiveObject(comment.thecomment.getChildAt(1)).tabIndex = 50;
//Changelog knap
changelog.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndPlay(30);
}
thesubmitform.thesend_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
//Validerer email
if (validateEmailAdress(bestilinfo.mahemail.text) == false) {
thesubmitform.myfeedback.myfeedback.text = "Din email er ikke en valid email";
}else {
//validerer formen
if (bestilinfo.mahname.text == "" || bestilinfo.mahsted.text == "" || bestilinfo.mahemail.text == "" || bestilinfo.mahtlf.text == "" || informationcopy.mybirthdate.text == "" || informationcopy.myname.text == "" || informationcopy.myadresse.text == "" || informationcopy.mycity.text == "")
{
thesubmitform.myfeedback.myfeedback.text = "Udfyld venligst alle felterne";
}
else
{
//Radiobutton vars
var choice:RadioButtonGroup = new RadioButtonGroup("choice");
rb2.label = "Ændring";
rb3.label = "Afbestilling";
rb2.group = choice;
rb3.group = choice;
if (choice.selection.label == "Ændring")
{
statustxt.text = "Ændring";
}
else
{
statustxt.text = "Afbestilling";
}
//Variabel til PHP script
//laver en variable container
var allVars:URLVariables = new URLVariables();
//Bestillerinformation
allVars.mahname = bestilinfo.mahname.text;
allVars.mahsted = bestilinfo.mahsted.text;
allVars.mahemail = bestilinfo.mahemail.text;
allVars.mahtlf = bestilinfo.mahtlf.text;
//Brugerinformation
allVars.mybirthdate = informationcopy.mybirthdate.text;
allVars.myname = informationcopy.myname.text;
allVars.myadresse = informationcopy.myadresse.text;
allVars.mycity = informationcopy.mycity.text;
allVars.telefon = informationcopy.telefon.text;
//Udkørselinformation
//Dato
allVars.thedate = turadministration.thedate.text;
allVars.thedate2 = turadministration.thedate2.text;
allVars.thedate3 = turadministration.thedate3.text;
allVars.thedate4 = turadministration.thedate4.text;
allVars.thedate5 = turadministration.thedate5.text;
//Fra adresse
allVars.theadresse = turadministration.theadresse.text;
allVars.theadresse2 = turadministration.theadresse2.text;
allVars.theadresse3 = turadministration.theadresse3.text;
allVars.theadresse4 = turadministration.theadresse4.text;
allVars.theadresse5 = turadministration.theadresse5.text;
//Til adresse
allVars.theadresse21 = turadministration.theadresse21.text;
allVars.theadresse22 = turadministration.theadresse22.text;
allVars.theadresse23 = turadministration.theadresse23.text;
allVars.theadresse24 = turadministration.theadresse24.text;
allVars.theadresse25 = turadministration.theadresse25.text;
//Fremme kl
allVars.thetime = turadministration.thetime.text;
allVars.thetime2 = turadministration.thetime2.text;
allVars.thetime3 = turadministration.thetime3.text;
allVars.thetime4 = turadministration.thetime4.text;
allVars.thetime5 = turadministration.thetime5.text;
//Hjemkørsels information
//Dato
allVars.date1 = turadministration.date1.text;
allVars.date12 = turadministration.date2.text;
allVars.date13 = turadministration.date3.text;
allVars.date14 = turadministration.date4.text;
allVars.date15 = turadministration.date5.text;
//Fra adresse
allVars.adresse1 = turadministration.adresse1.text;
allVars.adresse2 = turadministration.adresse2.text;
allVars.adresse3 = turadministration.adresse3.text;
allVars.adresse4 = turadministration.adresse4.text;
allVars.adresse5 = turadministration.adresse5.text;
//Til adresse
allVars.adresse2 = turadministration.adresse2.text;
allVars.adresse22 = turadministration.adresse22.text;
allVars.adresse23 = turadministration.adresse23.text;
allVars.adresse24 = turadministration.adresse24.text;
allVars.adresse25 = turadministration.adresse25.text;
//Hentes kl
allVars.time1 = turadministration.time1.text;
allVars.time2 = turadministration.time2.text;
allVars.time3 = turadministration.time3.text;
allVars.time4 = turadministration.time4.text;
allVars.time5 = turadministration.time5.text;
//Kommentar
allVars.thecomment = comment.thecomment.text;
//Emne
allVars.choice = statustxt.text;
//Leverer data fra flash til PHP
//NOTE: leverer data til beta på næste linje
var mailAdress:URLRequest = new URLRequest("http://www.lithin.com/flashtest/beta/sender.php");
mailAdress.data = allVars;
mailAdress.method = URLRequestMethod.POST;
sendToURL(mailAdress);
//Giver brugeren et feedback at mailen er sendt og resetter formen.
//resetter brugerinfo
informationcopy.mybirthdate.text = "";
informationcopy.myname.text = "";
informationcopy.myadresse.text = "";
informationcopy.mycity.text = "";
informationcopy.telefon.text = "";
//Udkørsel
//resetter udkørsels dato'er
turadministration.thedate.text = "";
turadministration.thedate2.text = "";
turadministration.thedate3.text = "";
turadministration.thedate4.text = "";
turadministration.thedate5.text = "";
//resetter udkørsels fra adresser
turadministration.theadresse.text = "";
turadministration.theadresse2.text = "";
turadministration.theadresse3.text = "";
turadministration.theadresse4.text = "";
turadministration.theadresse5.text = "";
//resetter udkørsels til adresser
turadministration.theadresse21.text = "";
turadministration.theadresse22.text = "";
turadministration.theadresse23.text = "";
turadministration.theadresse24.text = "";
turadministration.theadresse25.text = "";
//resetter udkørsels fremme kl
turadministration.thetime.text = "";
turadministration.thetime2.text = "";
turadministration.thetime3.text = "";
turadministration.thetime4.text = "";
turadministration.thetime5.text = "";
//Hjemkørsel
//resetter hjemkørselsdato
turadministration.date1.text = "";
turadministration.date2.text = "";
turadministration.date3.text = "";
turadministration.date4.text = "";
turadministration.date5.text = "";
//resetter hjemkørsel fra adresser
turadministration.adresse1.text = "";
turadministration.adresse2.text = "";
turadministration.adresse3.text = "";
turadministration.adresse4.text = "";
turadministration.adresse5.text = "";
//resetter hjemkørsel til adresser
turadministration.adresse21.text = "";
turadministration.adresse22.text = "";
turadministration.adresse23.text = "";
turadministration.adresse24.text = "";
turadministration.adresse25.text = "";
//resetter hjemkørsel tid
turadministration.time1.text = "";
turadministration.time2.text = "";
turadministration.time3.text = "";
turadministration.time4.text = "";
turadministration.time5.text = "";
//resetter kommentar og poster en verificerings meddelse
comment.thecomment.text = "";
thesubmitform.myfeedback.myfeedback.text = "Sendt! Hvis der er nogle spørgsmål så ring venligst til 72 100 700";
}
}
}
function validateEmailAdress(emailString:String):Boolean{
var myRegEx:RegExp=/(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
var myResult:Object = myRegEx.exec(emailString);
if(myResult==null){
return false;
}
return true;
}
//Changelog knap
changelog.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);
function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent):void
{
gotoAndPlay("Changelogsection");
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|