Changing the form submission
page on the fly!
A question I tend to get quite often is how can
I specify a FORM submission page on the fly, by this I mean if I have a select
(dropdown) and I want to allow the user to go to a specific page depending on
what action they want to do, but I also want to send FORM variables, how can I
Well, this example does not use any ColdFusion,
but it's something that many beginning ColdFusion developers out there tend to
ask and so I felt that it would be a good tutorial to post on EasyCFM.COM.
Now this sounds like a simple solution, to have
creativity, you can achieve that all on a single page... let me show you how...
The first thing you must do is to create the
// Create a function that will change the form action value
on the fly.
//The line below will define the page the forms submits to.
document.WhatToDoForm.action = page;
// Te line below will actually submit the form.
easy part :)
selected>Define what you want to do?</option>
Ok, now notice that there is "NO"
submit button, the actual select box will act as the SUBMIT button when a value
is selected and it will submit the form to the specified page.
Also, notice that the FORM NAME is in MAROON,
Well, that's pretty much it, Questions?
Comments? Let me know...