codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Form Submission Options  Archive Import (Teresa) at 15:57 on Tuesday, August 12, 2003
 

Hello.

I`m relatively new to javascripting. I`m trying to have something specific happen when someone clicks on the submit button of a form I have in a web page:

1. submit / email the form
2. then either reset the form or reload the page so the fields are blank
3. then have an alert pop up saying "Thank you. Your email has been sent."

Not sure how I can do this as I`ve not tried to combine javascripting with forms before. Would appreciate any pointers.

--Teresa

  Re: Form Submission Options  Troy Wolf at 11:12 on Wednesday, August 13, 2003
 

Teresa, before I answer, what do you already know how to do?

Do you know how to do any server-side scripting? (ASP/PHP/CGI ?)

The standard way to process a form (store the data in a database, email the results, send a thankyou email, etc.) is to submit the form to a script page on your webserver (such as ASP/PHP/CGI). This page requires programming skill to build, but you can do about anything you want with the data, then your code can write an HTML thank you page and send it back to the user`s browser.

If you don`t know how to do any server-side scripting, and all you want is the form results emailed to you and a thank you message presented to the user, then there are free and pay services that you can submit your page to that will #1) Email the form to the email address you provide, then #2) redirect to your Thankyou.html page--you usually use hidden elements in your form to specify values such as Email Address and Thankyou Page.

I can`t recommend a service because I haven`t used any, but search for "free form emailer" or something like that. One that I found that has a low fee is:
http://www.formmail.com/cgi-bin/webscr

If you have more specific questions, feel free to reply!
Troy Wolf: site expert
SnippetEdit Website Editor


  Re: Form Submission Options  Archive Import (Teresa) at 02:43 on Thursday, August 14, 2003
 

Hi Troy. (will not put honkin` huge smiley here, but know that I`m smilin` <grin&gt

I`ve got some very basic intro skills in javascript and php. The next part of the website I`m working on involves having a search page for a mySQL db that I`m setting up, something I need to bootstrap myself through because, as I`ve said before, I have rank beginner status in both javascripting and php.

The client is happy to receive the emails and don`t need the form`s info stored anywhere. They are responding to requests for information, contacting the emailer in person.

So, I just wanted to attach a simple alert to the submit form button, as well as having the page reset with either way I mentioned above.

In the meantime, I`ve got a "Learn php in 21 days" book to help reinforce what little I managed to absorb in class (which was not much considering the amount of stress I was going through at the time, lol)

--Teresa

  Re: Form Submission Options  Troy Wolf at 12:54 on Friday, August 15, 2003
 

Well, Teresa, I can`t help you with PHP or MySql specifically because I`ve never used them, but those two technologies will allow you to do about anything you want to do in a data-driven, dynamic website! Keep up the learning! The competing Microsoft way is ASP and SQL Server. I`d love to know PHP and MySql as well--it`s not that I don`t like them or respect them, but I found I can`t be a guru of ALL of it--I had to specialize a bit to be good! There are many people better than I who seem to be very good with both the Windows and UNIX/Linux ways.

I`m not sure why you want an alert to fire when the form is submitted AND return a thank you page to the user, but here is some code to show you exactly how to trap the form submission event so you can code anything you want. Check out this thread:
http://www.codetoad.com/forum/15_19625.asp
The secret is two fold: First, don`t use a type=submit button as you`ll see in the code example. Second, disable the default submit action by using onsubmit=false in the form tag--as you`ll see in the code example. Now you can use javascript to validate the form, popup events, cancel the form submission, etc. One possibly good side effect is that this method forces the user to have javascripts enabled to submit your form--this means they can`t easily get around your client-side validation script.

As for taking the form results and emailing them, you can use a free or fee-based service as I suggested above, or with some minimal PHP, you can process the form and email the results. Like I said, I can`t help you with the PHP code to do this, but you should find code examples galore with a few searches. Since you are going down the PHP and MySql path, I suggest you code your own -- don`t use the form processing service!

Hope I`ve helped! Maybe a PHP guru will post some code here for you.
Troy Wolf: site expert
SnippetEdit Website Editor


  Re: Form Submission Options  Elain at 08:45 on Thursday, January 13, 2011
 

:) I can't give you any help, bacause i think it is difficult for me to answer your question!
____________________________________________
decompiler for mac|tree menu|flash banner








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Doubles .toString Error: double cannot be dereferenced.
•  Re: What VBA code can I use to extract the IP Address
•  Re: difference between activex dll and an exe
•  Re: New user, trying to figure out how `find` works....
•  Re: adding a querystring parameter in a button click event
•  Re: onclick thumbnail images in gridview or datalist
•  Re: MDI form open size and location
•  Re: where can i download javax.speech package
•  Re: need help with main()


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2011