Hi azadi.
Could this articel help too?
http://tutorial55.easycfm.
Main Topics
Browse All TopicsHello experts.
I need help to decide wich method i should use to pass form values from two search pages (two search forms) to one result page and one detailpage.
To build this i have used Url variables.
On the result page i have two link to the searchpage1 Or 2 depending on a Url variable and using
<cfswitch and cfcase.
The first link is :New search
And the second to Edit the search fields using the url variables:
I also handle the number of records with a form.
And the function sort by that works with url variables too.
I have also alink to the detail page.
On the detail page are these two links for new search and edit search and a third one that goes to the result page(not back)
The question is how can i pass the search values from page to another page.
f.e if i choose 20 for number of records than i loose the search values in URl.If i add #CGI.Query_String# to URL i get more than once the value for the records.
And than from the result page to the detail and than back how can i pass the values back.
Do i have to use Form variables instead of Url.Do i have to use cookies or session?
Please help.
Here are part of the codes .
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi azadi.
Could this articel help too?
http://tutorial55.easycfm.
yes, something like that will let you create a copy of submitted form from its values, or create a query string to add to a link url.
a slightly 'better' equivalent of it is using array notation instead of evaluate() function:
A) create a query string from submitted form fields and their values:
<cfloop index="thefield" list="#form.fieldnames#">
<cfset querystring = thefield & "=" & form[thefield] & "&">
</cfloop>
<cfset querystring = "?" & left(querystring, len(querystring)-1)>
this querystring can be added to a link that takes users back to results page, or to editing search criteria page...
<cfoutput><a href="somepage.cfm#queryst
B) create a new hidden form from submitted form fields and their values:
<form ...>
<cfoutput>
<cfloop index="thefield" list="#form.fieldnames#">
<input type="hidden" name="#thefield#" value="#form[thefield]#" />
</cfloop>
</cfoutput>
</form>
you can then use a link with a little javascript in onclick event that set's the form's action page and submits it...
there is no 'uiversal' way to deal with your situation. the best way for you to approach the issue (to use session scope, or re-create forms, or use url variables, or a combination of these) will be determined by your data, your application setup and how much time you can devote to this.
Azadi
Hi azadi.
Thank you fo your help and the detailed description and i think i'm very near to solve my problem.
I tried the A) but when i click on the link (on the same page) i get the error Element FIELDNAMES is undefined in FORM and in the url has been added only one form field and his value.
And as i want first of all to submit to the page that i'm allready (result page)please help with the script that i need in the B) case.
My form is on the searchpage.
action page is now in my example testfields.cfm and there is the link.
Here is the testfields.cfm with all the variations.
<cfparam name="form.fieldnames" default="">
<cfparam name="querystring" default="">
<cfloop index="thefield" list="#form.fieldnames#" >
<cfset fields="#thefield# = #evaluate(thefield)#">
<cfoutput>#fields#</cfoutput><b
</cfloop>
<cfloop index="thefield" list="#form.fieldnames#">
<cfset querystring = thefield & "=" & form[thefield] & "&">
</cfloop>
<cfset querystring = "?" & left(querystring, len(querystring)-1)>
<cfoutput><a href="testfields.cfm#query
B.
<form action="testfields.cfm">
<cfoutput>
<cfloop index="thefield" list="#form.fieldnames#">
<input type="hidden" name="#thefield#" value="#form[thefield]#" />
</cfloop>
</cfoutput><input name="" type="submit" />
</form>
Business Accounts
Answer for Membership
by: azadisaryevPosted on 2009-05-08 at 02:17:50ID: 24334211
you can use either SESSION or FORM vars for this - they both have their pros and cons:
1) FORM vars:
pros:
each form, if a user decides to open several tabs with your search form, will be unique and post its own values to the action page
cons:
you will have to re-create the form (using hidden fields if you do not need to display and form fields to the user) on each and every page, grabbing posted form vars and populating a new form with them. all your 'links' to other pages that use these form vars will have to be form posts, not your regular href links.
2) SESSION vars:
pros:
no need to re-create form on every page of the process
cons:
unless you implement some unique form identifier, pass it along to other pages (i.e. as a URL or FORM variable) and create a separate session structure for each unique form, if a user opens several tabs with your search form you may end up overwriting your session vars with values from a from opened in a different tab, confusing the hell out of your users...
so, basically, in either case there will be some sort of duplication of variables, either as a new session structure or a new form...
the FORM way will be easier if your results pagination is javascript (client-side) based: it's harder to put a client-side ui selection (like currently viewed page, or number of results per page if that's an option you provide) into session scope than to populate a hidden form field with a little js...
i will try to make a quick example for you and post it here.
Azadi