Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is wrong with this code 1

Status
Not open for further replies.

offdarock

Programmer
Sep 8, 2003
132
CA
I set my cookies on this page based on feedback form

<cfcookie name="question1" value="#form.question1#">
<cfcookie name="question2" value="#form.question2#">
<cfcookie name="question3" value="#form.question3#">



then on a subsequent page I try to access them

<cfif cookie.question2 is "yes">
<cflocation url="technicalSupport.cfm">
<cfelseif cookie.question3 is "yes">
<cflocation url="storeService.cfm">
<cfelse>
<cflocation url="finish.cfm">
</cfif>



I get this error...

Error resolving parameter COOKIE.QUESTION2


The cookie value QUESTION2 was not found in the current template file. The cause of this error is very likely one of the following things:


The name of the cookie variable has been misspelled.
The cookie variable has not yet been created or has timed out.
 
Please change the first <Cfcase in my previous posting to this
Code:
<cfcase value="firstPage">
    <cfparam name="question1" default="no">
    <cfparam name="question2" default="no">
    <cfparam name="question3" default="no">
    <cfparam name="question4" default="">
    <cfparam name="question5" default="">
    <cfparam name="question6" default="">
<!---build the list of pages to jump next.--->
<cfset session.listOfPages="">
<cfif question1 is "yes">
    <cfset session.listOfPages=listAppend(session.listOfPages,"customerService.cfm")>
</cfif>	
<cfif question2 is "yes">
    <cfset session.listOfPages=listAppend(session.listOfPages,"technicalSupport.cfm")>
</cfif>
<cfif question3 is "yes">
    <cfset session.listOfPages=listAppend(session.listOfPages,"storeService.cfm")>
</cfif>
 
    <cfset session.listOfPages=listAppend(session.listOfPages,"finish.cfm")>
    <cfset session.question4=question4>
    <cfset session.question5=question5>
    <cfset session.question6=question6>
    
</cfcase>

PLease answer these two questions.
1) If I select No on Question1, Yes on Question2 and No on question3 I should get redirected to technicalSupport.cfm. In that page you have another form, what is the Action value for that Form??

2)After all your data collection is finished you have to do the final processing in finish.cfm right?
What do you have on finish.cfm so far?



grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
If you select no - yes - no then you only go to technical support...you will collect more data on the Technical support page...then you will be forwarded to the finish.cfm page.


on the finish.cfm page there is a <textarea> box for you to reply with extra comments....then everytheing gets forwarded to the finishProcessor.cfm page to get added to the database.

in the finishProcessor. I set the sessions to ="0"

<cfparam name="session.question4" default="0">
....
<cfparam name="session.question36" default="0">

just incase someone misses a question
then I do the insert.

 
OK, we are getting closer...
Let's pretend your initial form is in a page called index.cfm. THe form on that page is going to basicSurveyProcessor.cfm. SO far so good.

Now, let's say all three questions are set to Yes.

What you have in mind is this?

index.cfm-->basicSurveyProcessor.cfm-->customerService.cfm-->technicalSupport.cfm-->storeService.cfm-->finish.cfm

Is this correct?

'Cause what I'm thinking is having a central point to redirect the pages, something like.

index.cfm-->basicSurveyProcessor.cfm-->customerService.cfm-->basicSurveyProcessor.cfm-->technicalSupport.cfm-->basicSurveyProcessor.cfm-->storeService.cfm-->basicSurveyProcessor.cfm-->finish.cfm


I know it seems an overkill, but actually is a pretty good way of having things centralized, if you need to fix or change something you just do it in one place.
The only trick here is telling the 'processing' page where are we coming from, that's why you need to hardcode in your forms a hidden value

<input type=hidden" name="originator" value="techSupport">

The bold value is what you look for on the big switch, you'll have a different value depending on what form you are in. The basicSurveyProcessor.cfm is just a central gathering place for all your answers, after you load them in the Session scope you jump to the next page on the list.


Example1: If the user doesn't select anything then the only page on the list will be finish.cfm, they get there fill out the extra comments and from there go to finishProcessor.cfm.
Example2: If the user selects Question1 and Question 3 as Yes then the list will have three entries (customerService.cfm,storeService.cfm,finish.cfm)

the process will take the first entry on the list and reduce the list to only two pages.
(storeService.cfm,finish.cfm)
then it will jump to customerService.cfm.

Once the user submits the page in customerService.cfm the process will check the 'originator' value, it will load all the variables that your are expecting from customerService.cfm into the Session scope and then will grab the next page in the list.storeService.cfm... then the story repeats again until you reach finish.cfm

that makes more sense??
let me know if are on the same page....




grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
Actually I got it working about 6 pm today...thanks a million for your help....and drop by the site sometime.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top