Jump to content
xisto Community
kvarnerexpress

Passing Variables Through A Page?

Recommended Posts

I have a form that people fill out. Depending on what they fill out on that form, they get different things on the page they're taken to after hitting "submit". Information from both pages goes into a database.However, I don't want to create a new row until the second page has been filled out and submitted (taking the user to a third page). Is there any easy way to pass all the variables from the first page through the second and to the third? I know I can stick it all in hidden inputs, but I have more than 60 form items to process, and I'd like to not have to code an entire page just to pass them as possible.

Share this post


Link to post
Share on other sites

I have a form that people fill out. Depending on what they fill out on that form, they get different things on the page they're taken to after hitting "submit". Information from both pages goes into a database.
However, I don't want to create a new row until the second page has been filled out and submitted (taking the user to a third page). Is there any easy way to pass all the variables from the first page through the second and to the third? I know I can stick it all in hidden inputs, but I have more than 60 form items to process, and I'd like to not have to code an entire page just to pass them as possible.


Well if you have 60 items to collect, you are going to have to track 60 items page to page unless you do some interim database solution in between. One idea that might make it easier would be to name you Form UI objects according to some pattern: txtBox1, txtBox2, txtBox3 and then write a cfloop to go over them...then instead of writing 60 hidden inputs to maintain you would have something more manageable.

I suppose you could also do session variables but that might put more wear-n-tear on your server then you want.

Thougts?

Share this post


Link to post
Share on other sites

Well if you have 60 items to collect, you are going to have to track 60 items page to page unless you do some interim database solution in between. One idea that might make it easier would be to name you Form UI objects according to some pattern: txtBox1, txtBox2, txtBox3 and then write a cfloop to go over them...then instead of writing 60 hidden inputs to maintain you would have something more manageable.
I suppose you could also do session variables but that might put more wear-n-tear on your server then you want.

Thougts?


Isnt there the equivalent of a cookie in CF? If there is there should be no reason to track all 60 items within each page. Im sure theres a way you can create session variables.

Share this post


Link to post
Share on other sites

One possible solution might be to place the items from the first page in to an array and then write the array to a temp database, passing only a row id number before handling the second page, storing the second page info into a second array, then read the first array back and concatenating the two arrays before writing to the db? A bit of a struggle, but if you can code it like suggested above so that the data handling can be looped by an index, it probably wouldn't be so bad.

Share this post


Link to post
Share on other sites

Isnt there the equivalent of a cookie in CF? If there is there should be no reason to track all 60 items within each page. Im sure theres a way you can create session variables.


ColdFusion does have a <cfcookie> tag but why store all the values as cookies...it would be easier and probably efficient to use the an html input field or cfinput field instead. Cookies would only come in handy if you were trying to ease the users data entry if they were visiting your site / pages on a reoccuring basis.

:huh:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.