Multiple form actions pt. 1
- November 8th, 2009
- Posted in Nifty Idea
- Write comment
If you’ve ever coded a html form, there is a good chance you’ve been asked by a client to have that form go to more than once place. There are many ways to accomplish this … and I’ve come up with one of my own.
Let’s start out with the simple steps.
- User lands on your Landing Page
- User fills out the form on your Landing Page
- User submits the form
- User arrives at the ‘Thank You’ page
Let’s add in the steps that the user doesn’t see.
- User lands on your Landing Page
- Hidden date/time/affiliate form fields are populated
- User fills out the form on your Landing Page
- User clicks Submit button
- Form is validated for required fields
- Controller.php is invoked via the form action=”controller.php” tag element
- Controller.php generates an email to you that says ‘hey, User has filled out your form!’
- Controller.php finishes and throws the user over to the Thank You Page
While this process is more involved than the user knows, it remains fairly straight-forward. It is simple, and useful… but what happens when we want the user to fill the form out twice? Users don’t like being asked twice to do something… especially when it comes to ponying up their email address.
Let’s have a user fill out the form once. Let’s say it signs the user up for your Affiliate Program. The user is aware of what is going on, we’re not here to play tricks on anyone. Let’s also say that the Affiliate Program you use is robust and powerful, and if you click this link, the shameless author (me) will get a few bucks if you end up buying the software. Let’s also be honest and admit that the Affiliate Program’s email marketing functionality is pretty weak.
You want the form to sign the user up to your iContact email list as well as Post Affiliate Pro. This can be accomplished with a single click, and the user will be signed up for your program and also get all of the emails you send them. Do Not Spam your email list, treat these folks as you would treat your own children. They’re your lifeblood, and you should do right by them. /soapbox
Again, we’ll break down what needs to happen from our super-smart webguy/webgirl perspective:
- User lands on your Landing Page
- Hidden date/time/affiliate form fields are populated
- User fills out the form on your Landing Page
- User clicks Submit button
- Form is validated for required fields
- Controller.php is invoked via the form action=”controller.php” tag element
- Controller.php generates an email to you that says ‘hey, User has filled out your form!’
- Controller.php finishes and throws the user over to the Thank You Page
- On the Thank You Page, an invisible form with the exact same fields as the Landing Page is loaded
- Invisible div with an iframe is on the Thank You page.
- OnLoad event invokes a small javascript that submits the form data again, this time to iContact, via the invisible iframe
- User is now signed up in your iContact account.
Stay tuned for the next post where we take a look under the hood. It will be full of fun, php, javascript, html and cake. Except for the cake.
-Dan
No comments yet.