Topic: url work around needed

Dai    -- 01-10-2007 @ 10:17 AM
  <CFFORM action="formdump.cfm" method="post" format="flash" height="500">
     <CFTREE name="hotelTypes" height="350" width="300" appendkey="no">
     <CFOUTPUT query="">
          <CFTREEITEM value="" display="" expand="yes">
          <CFTREEITEM value="#resort_name#" display="#resort_name#" parent="" expand="no">
          <CFTREEITEM value="#accom_type#" display="#accom_type#" parent="#resort_name#" expand="no">
          <CFTREEITEM value="#accom_name#" display="#accom_name#" parent="#accom_type#" expand="no"
Ok folks this is the tree component I'm using which works fine except for the url problem.
Which is an extra ? On the end of the url in the address bar. By the way this is a macromedia bug or so I read in a forum last night.

This is the test address I'm using:

One other thing am I using URLEncodedFormat(resort_name) properly

So lets get down to the nitty gritty. Is there a way to reset the variable of the hotel name in the address bar to what ever the name of hotel is passed to the page. Then insert this new variable into the databse.

I know I can't just  reset the value in the variable because I won't know what that is until it is passed from the previous page which could be any number of hotels that are listed there.

So is there a function where I can just knock off the last character in a word in my case the ? Character. Then reset the variable.

This is the output from the url:


San Antonio
all inclusive

nmiller    -- 01-10-2007 @ 11:49 AM
  you can't alter the URL in the browser, but you can remove the ? in your code:


Is that what you're trying to do?

Nathan Miller
NM Consulting

Dai    -- 01-10-2007 @ 2:37 PM
  <cfset accomodation = "#replace(URL.hotel,"?","")#">
and relaced variable in db to #accomodation #

This seems to have done the trick.

Nice simple elegant solution.

Thank you very much.

will do some testing and hope everything runs smoothly.

nmiller    -- 01-10-2007 @ 4:06 PM
  just a note about your syntax - don't waste time using unnecessary quotes and pounds when setting variables...

<cfset accomodation = replace(URL.hotel,"?","")>

Nathan Miller
NM Consulting

Dai    -- 01-11-2007 @ 5:38 AM
  I do get what your saying about
<cfset accomodation = replace(URL.hotel,"?","")>

but I get this error (see below)if I take out the ## signs:

Invalid token '?' found on line 8 at column 43.

The CFML compiler was processing:

    * an expression beginning with "\"", on line 8, column 23.This message is usually caused by a problem in the expressions structure.
    * a cfset tag beginning on line 8, column 2.

The error occurred in C:\CFusionMX7\wwwroot\review1\formdump.cfm: line 8

But if I leave the ## signs in it, it works like a charm
and you know what they say Nathan If it ain't broke don't fix it
You are absolutely right though there is no need to use ## when setting a variable this way. In a way I'm glad I messed up otherwise I might be still struggling to find the answer to the problem because it would be throwing the above error.

Dai    -- 01-11-2007 @ 10:15 AM
  Is there anyway of appending a URl to the tree item when a tree is written like this:

<cfform action="formdump.cfm" method="post" preloader="no" format="flash" height="500">
     <cfformitem type="html">
     <TEXTFORMAT indent="20"><font size="-2" color="#FF0000">
     click arrows to expand the folders</font>

     <cftree name="hotelTypes"
          width="300" appendkey="no">
     <cftreeitem query=""
          value="resort_name, accom_type"
          display="resort_name, accom_type"

The tree does not seem to accept the appended URL
formdump.cfm is ok but, from ? onwards stops it from working.

Any body know why and is there a way around it?

Thanks in advance

EasyCFM.COM ColdFusion Forums :