Easy Page navigation using CFSwitch and URL Variables
ColdFusionIn some of my apps I've been writing, using CFSwitch is a really nifty way to do conditional processing on my pages, allowing me to get away from an endless number of CFIF's. Especially when using CFSwitch tags for controlling navigation on my application.
I know this isn't earth moving news for you seasoned cf developers out there, but I find cfswitch to be a very interesting and powerful tab.
A little back ground first. I'm slowly writing a app that will allow users to do reviews on service providers of a certain industry. I had a need for a page that has the service providers contact information, at the top, but has a link or tabs with links to be able to edit the service providers information, add notes, add a review, or view reviews. I didn't want to display all the forms down the page as I wanted it all on one screen so the user didn't have to scroll all the way to the bottom to add a note. They could click on a link, that would leave the service provider contact information at the top of the page, but change the form at the bottom to the appropriate form to add a note or what ever link or tab they clicked on.
As your reading this code, of course there are some assumption you will need to make. Like, this page is the resulting page from a query or a drill down page from a query. The initial url would be "index.cfm?=serviceproviderID=#url.IDFromDatabase#"
So, here's the code:
It seems to work pretty well. Being new to this whole programming thing it was pretty neat to figure this out and not have to depend on someone elses snippet to get it working. So I figured I'd post it in case some other newbie need something like this on there page. This is the first time I've posted any code like this. I took my working code and "sanitized it" for this entry, so if you see an issue with it please let me know.
Later,
Mark






Loading....