Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Clearing/Resetting input text boxes

New Here ,
Feb 22, 2008 Feb 22, 2008
i have an email form that works built in flash. Id like to know how to clear the fields and make them blank again when the email is submitted and goes through....this is how the code i have looks so far:

on (release) {
if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
}

else if (!FirstName.length) {
EmailStatus = "Please Enter your first name before Sending";
}
else if (!LastName.length) {
EmailStatus = "Please Enter your last name before Sending";
}
//else if (!Subject.length) {
//EmailStatus = "Please enter a subject before sending your message";
//}
else if (!Message.length) {
EmailStatus = "Please enter some text in you message";
}
else if (!Phone.length) {
EmailStatus = "Please input your phone number";
}
else {
loadVariablesNum ("snowMailPHP.php", "0", "Post");
EmailStatus = "Thank you for your message. We at will respond to you promptly";


//else if (!ToEmail.length || ToEmail.indexOf("@") == -1 || ToEmail.indexOf(".") == -1) {
//EmailStatus = "Please enter a valid E-mail address that you are sending this to";}

//else if (!ToName.length) {
//EmailStatus = "Please Enter the name of how you are sending this to";}

}
}



What would i add to this to make the fields go blank again after the submission? Thanks
TOPICS
ActionScript
752
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 22, 2008 Feb 22, 2008
One solution is to put the instance names of each of the input textfields into an array and then go through each item in the array and set the .text property of each input field to "".
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 22, 2008 Feb 22, 2008
what would that code look like exactly? So far i tried:

ContactForms = new Array(
{FirstName.text:="",LastName.text:="",Email.text:="",Phone.text:=""}
);

else {
loadVariablesNum ("snowMailPHP.php", "0", "Post");
EmailStatus = "Thank you for your message. We at HST will respond to you promptly";
EmailStatus = ContactForms;


But i am getting errors. How would i write this correctly so that it works?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 23, 2008 Feb 23, 2008
You can place the array declaration in the same location as your send button's code. I'm guessing that is what you are trying above.

var contactForms:Array = new Array(FirstName,LastName,Email,Phone);

You just want to use the instance names in the array. Then when you use loadVariablesNum() you can then reset the text:

for (var i:String in contactForms) {
contactForms .text = "";
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 23, 2008 Feb 23, 2008
Im sorry but i cannot get that code to work.......The fields still remain populated after i hit the submit button. Any idea whats going on?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 24, 2008 Feb 24, 2008
Can you show the code that you're using?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 24, 2008 Feb 24, 2008

on (release) {
if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
}

else if (!FirstName.length) {
EmailStatus = "Please Enter your first name before Sending";
}
else if (!LastName.length) {
EmailStatus = "Please Enter your last name before Sending";
}
//else if (!Subject.length) {
//EmailStatus = "Please enter a subject before sending your message";
//}
else if (!Message.length) {
EmailStatus = "Please enter some text in you message";
}
else if (!Phone.length) {
EmailStatus = "Please input your phone number";
}
else {
loadVariablesNum ("snowMailPHP.php", "0", "Post");
EmailStatus = "Thank you for your message. We will respond to you promptly";

var contactForms:Array = new Array(First_Name, Last_Name, Email_Address, Phone_Number);
for (var i:String in contactForms) {
contactForms.text = "";
}
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 26, 2008 Feb 26, 2008
hello?????
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 26, 2008 Feb 26, 2008
if you really want to clear those fields when the email has been successfully processed, you'll need to have your php program return a value to flash. if you just want to fake it, you can use:

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 26, 2008 Feb 26, 2008
thank you sir......once again...you've come through for me.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 26, 2008 Feb 26, 2008
LATEST
you're welcome.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines