PDA

View Full Version : Forms in a Movie Clip



tranism
July 25th, 2003, 09:07 PM
I've created a form with validation that works. Problem is when I turn it into a movie clip, and place the clip on my timeline, the form no longer works. Any ideas on why this may be happening? Perhaps I have to reference _root but I'm not sure where.

aurelius
July 25th, 2003, 10:19 PM
More than likely, it's a target problem. If you can make all your references relative (use "this" instead of "_root", etc), that should solve the problems.

Digitalosophy
July 26th, 2003, 03:01 PM
yup, for example



submit.onPress = function(){
this.getURL("blah.php",0,"post");
}

tranism
July 28th, 2003, 12:26 PM
targeting with "this" isn't working. here is the actionscript for my submit button.

this.formData.sendAndLoad("http://www.bcbg.com/js/flashmailscript.php", replyData, "post");


am I missing something? I tried it with root also. Didn't help. sooo PLEASE HELP!

Digitalosophy
July 28th, 2003, 12:36 PM
whats happening? are the variable's not passing to your php page?

tranism
July 28th, 2003, 12:43 PM
Whats happening is whenever I hit the submit button, the form is never sent because its stuck on the validation cycle. For example;

in the email input field, a user types their email. The validation function looks to make sure that there is both an "@" and "." characters. But now, even if I do type in a valid email address, the validation function still tells me its not in the correct form and there for won't pass the variables to my script.

kode
July 28th, 2003, 12:57 PM
Post the code you're using to validate the form... ;)

tranism
July 28th, 2003, 01:01 PM
its pretty long but here it is. . .

//MY VALIDATION FUNCTIONS
function vEmail(){
if(formData.submit_by == ""){
errBox.setMessage("You Must Fill In Your Email Address");
return false;}
else{
if(formData.submit_by.indexOf(".",0) == -1 || formData.submit_by.indexOf("@",0) == -1){
errBox.setMessage("Your Email Address Is Not In Correct Form");
return false;}
else{
return true;}
}
}

function vfirstName(){
if (formData.first == ""){
errBox.setMessage("Oop's, you forgot to fill in your first name");
return false; }
else {
return true};
}

function vlastName(){
if (formData.last == ""){
errBox.setMessage("Oop's, you forgot to fill in your last name");
return false; }
else {
return true};
}

function vAddress(){
if (formData.address == ""){
errBox.setMessage("You must enter a valid Address");
return false; }
else {
return true};
}

function vCity(){
if (formData.city == ""){
errBox.setMessage("Oop's, you forgot to fill in your city");
return false; }
else {
return true};
}

function vState(){
if (formData.state == ""){
errBox.setMessage("Oop's, you forgot to fill in your state");
return false; }
else {
return true};
}

function vZip(){
if (formData.postal == ""){
errBox.setMessage("Oop's, you forgot to fill in your zip code");
return false; }
else {
return true};
}

//MY CLEAR ALL INPUT FIELDS FUNCTION FOR MY 'CLEAR' BUTTON
function clrData(){
formData.submit_by = "";
email.text = "";
formData.first = "";
firstname.text = "";
formData.last = "";
lastname.text = "";
formData.address = "";
address.text = "";
formData.apt= "";
apartment.text = "";
formData.city = "";
city.text = "";
formData.state = "";
state.text = "";
formData.postal = "";
zip.text = "";
}

//MY REPLY FUNCTION AFTER MESSAGE IS SUCCESSFULLY OR UNSUCCESSFULLY SENT
function myOnLoad(success){
errBox.setEnabled(true);
if(success){
errBox.setIcon("info");
errBox.setTitle("Thank You");
errBox.setMessage("Thank You for joining the BCBG mailing list.");
errBox._visible=true;
clrData();
}
else{
errBox.setIcon("warning");
errBox.setTitle("System Error");
errBox.setMessage("Oop's an error occured while submitting. Please try again.");
errBox._visible=true;
}
}

//MY SUBMIT FUNCTION TO SEND ALL INFORMATION TO MY SCRIPT SERVER SIDE
function goPostal(){
if(!vEmail()) {errBox._visible=true;return;}
else if(!vfirstName()){errBox._visible=true;return;}
else if(!vlastName()){errBox._visible=true;return;}
else if(!vAddress()){errBox._visible=true;return;}
else if(!vCity()){errBox._visible=true;return;}
else if(!vState()){errBox._visible=true;return;}
else if(!vZip()){errBox._visible=true;return;}

errBox.setIcon("info");
errBox.setTitle("Sending Mail");
errBox.setMessage("Your Email Is Being Submitted");
errBox._visible=true;
errBox.setEnabled(false);
this.maillist.formData.sendAndLoad("http://www.bcbg.com/js/flashmailscript.php", replyData, "post");

}

tranism
July 28th, 2003, 01:49 PM
anybody?? :(

Digitalosophy
July 28th, 2003, 02:20 PM
honestly there is so much code, i'm not sure where to start. a good way to trouble shoot, is make a replica of what you want to do, with only one textbox, and get that to work. once to see how it works, you can implement it to your larger project