|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Strange Behavior Passing Varaibles...
Hey all, so i'm passing a variable from one page to another...i've done this so many times I have no idea why this isn't working...
here's the code. <a href="more.cfm?portID=#Criteria#">More of this type</a> when I do a cfdump on the page, I get "trump" when I click the link and do a cfdump there, I get "[empty string]" I have no idea why the information is getting lost inbetween pages...any ideas? |
|
#2
|
|||
|
|||
|
It might help to have a little more of the code around the sending page and on the receiving page. Do you perhaps set the value of portID on the second page before you dump it? On the calling page is there more that one variable called Criteria (maybe different scopes) that might be confusing CF?
It would just help to have a little more code to look at... Else, I do not see anything here that would indicate something wrong... -Matt http://www.LearnFamily.com |
|
#3
|
||||
|
||||
|
Frequently when I have had problems of this sort, the placement or syntax of my cfoutput tags have been the culprit. In order to try to determine what the problem is here, I think we need to see a fair amount of the surrounding code.
|
|
#4
|
|||
|
|||
|
<cfset criteria="#form.criteria#">
so, i've tried setting it into a variable, or pulling it right out of the cfsearch directly...and neither have worked |
|
#5
|
|||
|
|||
|
Wait.. if you are trying to use form.criteria, that would be a problem. You should be using url.criteria... You are passing the variable in as a URL variable and not a FORM variable....
Check that out... If that does not help, do a CFDUMP of the FORM and URL variables... -Matt http://www.LearnFamily.com |
|
#6
|
|||
|
|||
|
that does not work either...and when I put the form.criteria into a variable and cfdump it, I get the correct result, so then adding that variable to send to the next page, should realistically be fine.
|
|
#7
|
|||
|
|||
|
Ok, let's assume that the varialbe does get passed correctly, first of all, do you see the variable correctly in the URL? (does it have spaces or anything funny that might need to be URLEncoded?)
On the second page, what happens when you do a cfdump on the URL variable? Is the portID there? I guess it just helps to see where you are using the variable on the second page... Don't know what else to say without more information... Hope that we can find a way to help you out... -Matt |
|
#8
|
|||
|
|||
|
in the URL it appears fine...
in the following page when I do a cfdump on URL.PortID I get [Empty String] |
|
#9
|
|||
|
|||
|
Although...when I use the same technique to pass an ID across, when I scroll over the link i'll see the ID it's about to pass, not #ID#
in this case, I see #form.criteria# when I roll over the link and in the URL of the following page, which makes me beleive something isn't right from the get go, but it all seems fine to me... Code:
<cfset criteria="#form.criteria#">
<cfsearch
name = "name"
collection = "numberonerulen"
criteria = "#Form.Criteria#">
<cfdump var="#criteria#">
<div align="right"><a href="more.cfm?portID=#form.criteria#">More of this type</a>
<!-- End Topic -->
that's the code that effects it, everything else around it really is HTML... |
|
#10
|
|||
|
|||
|
When you click the URL and go to the next page, do you see your URL variable in the URL up in the location box? ie.
http://www.mysite.com/page2.cfm?myurlvalue=10 ? If so, then that value should be available in the URL scope on that page. If it is not, then something you are doing is explicitly overwriting the URL scope.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#11
|
|||
|
|||
|
I end up seeing
http://www.blahblahURL.cfm?portID=#form.criteria# |
|
#12
|
|||
|
|||
|
and by the way, i'm not moving a number, i'm moving a string
|
|
#13
|
|||
|
|||
|
and when I do this...
<cfquery datasource="numberonerule" name="subjectindex"> select Name, quote, topic from quote where topic=#URL.PortID# </cfquery> I get a syntax error near the equal sign in the where statment... so, I figure it wants me to change it too '#url.portid#' which doesn't work either |
|
#14
|
||||
|
||||
|
Although it's been a while and I don't have access to my source code from this location, I have had this problem before.
I don't see any cfoutput tags in your code, so I will just have to assume you are using them correctly. I think the reason you are getting the text "#form.criteria#" instead of the value of the variable criteria is that you are assigning that value as a string to the new variable criteria in the following string Code:
<cfset criteria="#form.criteria#"> Try Code:
<cfoutput><cfset criteria=#form.criteria#></cfoutput> and see what happens. |
|
#15
|
|||
|
|||
|
Although I don't think the problem is there, I tried it and didn't work...
I know the form.criteria is being passed into the page properly because my verity searches work...and the cfdump shows form.critiera being whatever I sent from the search box in the previous page...I think it's got to have something to do with sending a string across, dunno..maybe i'll try it with a number to test it out |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Strange Behavior Passing Varaibles... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|