1

I'm a second-year CS student working on an internship with the South Dakota Geological Survey. I was hired to help with the databases but have since been tasked with updating webpages, creating JavaScript content, etc. I am still learning the ins and outs of CFML, JavaScript, and DHTML. Any help you can offer would be appreciated!

The problem: Our webpages, which access several scientific databases, were all written with forms where method ="POST". Our department would prefer method = "GET", so that we can create a permanent link and reference the results in other webpages. I've gone through all of the html and .cfm files, using Dreamweaver's design view as well as looking through the code manually, and changed all of the form references to GET on my test copy of the webpage. I haven't changed anything else, but changing POST to GET breaks the page and gives me a HTTP 500 Internal Server Error.

I've read through

http://www.communitymx.com/content/article.cfm?cid=E078CF4BDCC45632

and many other pages, as well as my DHTML desk reference to try and figure out what's breaking it, but I have to admit I'm stuck. When I change the references back to POST my test page works again.

The webpage in question is here:

http://www.sdgs.usd.edu/other/db.html

Specifically, the Lithologic Logs database.

Any input or assistance you could offer would be greatly appreciated- thanks so much for your time!

rjmunro
  • 27,203
  • 20
  • 110
  • 132
Katie
  • 49
  • 1
  • 9

2 Answers2

2

ok, when you send information to a .cfm page, either it'll be by POST or GET. If you POST information, then the .cfm page accesses those variables using the Form scope. If you GET information (i.e. put all the data into the URL querystring), then the .cfm page accesses those variables using the URL scope.

So check the page the error happens on. Chances are it's referring to something like form.foobar and you'll need to then change it to url.foobar.

duncan
  • 31,401
  • 13
  • 78
  • 99
  • Agree with duncan. Also, check to make sure that the URL querystring is not five miles long. There is a limit to how many characters you can jam on a URL. This can be set on the server (which may be why you are getting the HTTP 500 Internal Server Error), but some browsers will still choke on long URL's. See http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url – jk. May 18 '11 at 15:14
  • Thank you for the answer, Duncan- I've checked the search results page and the names of all of the variables inside cfparam tags start with the url prefix like so: I'm not sure if that's what you're referring to? Again, my apologies, I'm very new at this. – Katie May 18 '11 at 15:55
  • Thanks for the answer, Jen; the url generated when I attempt to perform a search on my test page is as follows: (http://www.sddenr.net/lithdb/search_results_lith_test.cfm?Search1=3&input_box=clay&search_type=simple&page_num=1&search=Search). It's long but not long enough to crash the browser, I think. – Katie May 18 '11 at 15:57
  • The error on the test page is Element SEARCH_TYPE is undefined in FORM. This is a ColdFusion error that can only be solved by looking at the CF code. You are past the 500 error so maybe now you can work it out. – jk. May 18 '11 at 16:43
  • Thanks Jen, I'll have a look! – Katie May 18 '11 at 16:48
  • Like jen says, change form.search_type to url.search_type and that'll be at least the first error fixed. But find every other reference to 'form.' or 'form[' in the files affected, they'll all need fixed. – duncan May 18 '11 at 16:49
  • replacing all of the form references with url fixed it! Thanks so much, everyone! You've made a bunch of geologists and one neophyte programmer very happy :) – Katie May 18 '11 at 17:02
1

Add

<cfset StructAppend(form,url,false)>

to onRequestStart inside of Application.cfc.

Phillip Senn
  • 46,771
  • 90
  • 257
  • 373
  • Thank you for the answer, Phillip. Unfortunately this code is rather antiquated and our website has yet to migrate from Application.cfm to Application.cfc. I will keep looking into it- however, being that I'm relatively new to CF and Dreamweaver, I hesitate to make changes that could bring the entire website crashing down. At least now I know more about what I don't know! :) – Katie May 18 '11 at 15:49
  • Just put it at the top of your application.cfm file and it will work. – Sam Farmer May 18 '11 at 16:20