Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quis and show send status and controll info!

Status
Not open for further replies.

HuggerFanta

Technical User
Apr 22, 2002
87
SE
Hello Group!
I´m building a site applicaton (Quiz-Like), and when subbmitting my answers I POST them to a PHP page that puts my answers and contact information in a database, then nothing happens.

But I was woundering if there is a way to get Flash to tell that the information has been sent?

And my second question is if there might be a way to check if a user has filled out the contact form, and then check if there is a valid e-mail adress? --------------------------------------
Kind regards;
HuggerFanta
 
Don't know about the first question, but if you want to check forms have been filled out, you can check each input field to make sure it's not equal to "", and for the email field, check that there is a @ and a . after it.

Something like this:

formFields = [name, address, phone, mobile];
send = true
for (i = 0, i < formFields.length, i++) {
if formFields == &quot;&quot; {
send = false
}
}
if (email.indexOf(&quot;@&quot;) > 0) {
if (email.indexOf(&quot;.&quot;, email.indexOf(&quot;@&quot;)) > 0) {
emailStatus = &quot;valid&quot;;
} else {
emailStatus = &quot;invalid&quot;;
} else {
emailStatus = &quot;invalid&quot;;
} _____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
Thanks!!!

But how do I get Flash to understand to do this???

There must be set to an action or function somehow??? --------------------------------------
Kind regards;
HuggerFanta
 
What I was typing in was the actionscript code for Flash to check your form fields. I didn't get it finished ... I hit submit by accident. Here's the rest of the code:
Code:
formFields = [name, address, phone, mobile];
send = true
for (i = 0, i < formFields.length, i++) {
 if formFields[i] == &quot;&quot; {
  send = false
  errorMessage = &quot;Please Complete All Fields\n&quot;
 }
}
if (email.indexOf(&quot;@&quot;) > 0) {
 if (email.indexOf(&quot;.&quot;, email.indexOf(&quot;@&quot;)) > 0) {
  emailStatus = &quot;valid&quot;;
 } else {
  emailStatus = &quot;invalid&quot;;
  errorMessage += &quot;Invalid Email Address&quot;;
} else {
 emailStatus = &quot;invalid&quot;;
 errorMessage += &quot;Invalid Email Address&quot;;
}
if (send == true && emailStatus == &quot;valid&quot;) {
 //  put your send code here
} else {
 //  put code to show an error message here
[code]
It's a little rough and ready, but it's a start ... _____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
OK!Do I put all of this code inside Flash, or do I have to put them inside the html page???

And how do I call for this function??? --------------------------------------
Kind regards;
HuggerFanta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top