Re: Cleaner way to retrieve a value from an XML node (XML-RPC)
Do you always know how many children will be returned for a specific node? If not you want to check this out. It will loop over children and you can work specifically with those items. http://www.bennadel.com/blog/1039-Ask-Ben-Iterating-Over-A-ColdFusion-XML-Document.htm Yes, but the number is different depending on the success or failure of the login. My instinct is to add logic to determine that success/failure first, then go find the node I need. Or, I'll see if I can use the technique in that blog to make it more compact. Thanks for pointing that out, Casey. (And thanks, Ben, for writing it). Cameron ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324169 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Cleaner way to retrieve a value from an XML node (XML-RPC)
Thank you, Dave. First, have you looked at this? http://support.journurl.com/users/admin/index.cfm?mode=articleentry=362 Great! I was searching for a component like that, and I never came across this one; just the two old ones that the author references. xmldoc child grandchildvalue1/grandchild /child child grandchildvalue2/grandchild /child /xmldoc I see. Going by the names of the nodes makes sense, and it's easier to read/manage. In that case, I've got this: cfset local.loginResponseSID = local.requestXMLObject.methodResponse.params.param.value.struct.member.value.string.xmlText / Is that the simplest/cleanest that this is going to get? Much appreciated. Cameron ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324127 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Cleaner way to retrieve a value from an XML node (XML-RPC)
Hi, folks. I'm retrieving an XML packet from an API that uses the XML-RPC standard (http://www.xmlrpc.com/spec). When I connect to the Login method of this API, I need to pull the session ID out of the packet. I can do that long-hand with this: cfset local.loginResponseSID = local.requestXMLObject.XMLRoot.XMLChildren[1].XMLChildren[1].XMLChildren[1].XMLChildren[1].XMLChildren[1].XMLChildren[2].XMLChildren[1].XMLText / But, there must be a cleaner way to do this, right? A note: the node that I am looking for is called string, BUT, if the login fails, there are multiple nodes called string in the response, so I can't do an XMLSearch for //string[.] and get just the one I need. FYI, the specific API that I am hitting is for iThenticate and the example is on page 16 of this PDF: https://ne.edgecastcdn.net/800404/static.ithenticate.com/static/build/media/e356a7e98a516945bba0af5293e8eb48cb_iThenticateAPIGuide.pdf) Any help to streamline this is much appreciated. Cameron ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324068 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using cffile and cfdirectory to create tinyURL-style aliases
Single quotes. Single quotes. (sigh) Thanks, Barney. The answer is that I needed the result to be consistent with what I've been doing manually for two years: creating directories and index.cfm files on the web server to get URLs like www.example.com/go/myURL. I wanted to create a quick add/edit/delete form so the marketing staff can manage these aliases themselves. Given the correct syntax, I knew this would work and it would produce the results I needed. That said, with this stable, I'll now look at a rewrite script to produce the same result. Before I dive in, can anyone point me to a good rewrite script that would give me: www.example.com/go/myURL Thanks for the info, and thanks for the 301 v 302 education. Cameron cfset fileOutput = 'cflocation url=#longURL# addtoken=false /' / One might ask why you're using directories and CFM files to accomplish this task. Every web server supports rewriting engines which would allow you to use a single script and a database to accomplish this task in a far more streamlined fashion. Further, you almost certainly want to be doing a 301 instead of a 302 to the long URL, which CFLOCATION doesn't provide. If you opt to continue down this route, probably want to use CFHEADER instead. cheers, barneyb On Thu, Mar 26, 2009 at 4:43 PM, Camer ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321041 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
using cffile and cfdirectory to create tinyURL-style aliases
Hi, all. I've been out of coding for too long and I can't figure this one out. Simple, really: using CFDIRECTORY and CFFILE, I want to create a folder, drop in an index.cfm file, then put a cflocation tag in that index.cfm file. !--- create directory --- cfdirectory action=CREATE directory=d:\test\#newDirectory# / !--- create index.cfm file in new directory --- cffile action=WRITE file=d:\test\#newDirectory#\index.cfm output=#fileOutput# / What I can't solve is how to write the CFLOCATION tag into the fileOutput variable. The resulting tag will be: cflocation url=#longURL# addtoken=false / I tried putting that into a CFSAVECONTENT, but that was actually processing the the redirect. Any help here? Thanks, Cameron ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321021 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: (ot) URL Hack Attempt Leaves Me Scractching My Head...
We got hit, and, according to the IIS logs, they hit non-standard templates in varied directories: /indexPrint.cfm /events/institute.cfm /search/TaxonomyResults.cfm /conferences/article.cfm /applications/statsmap/detail.cfm I don't see much of a pattern. Cameron For me, all attempts are focusing on rss.cfm. Another post said they saw sitemap.cfm being hit. Can anyone confirm any other templates that are being hit? Perhaps only 'commonly named' templates are being hit? Che ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309391 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Delete prior to an insert as a safeguard
Hello. I'm looking for some best practice advice with this one. In our membership database, we have a table where we assign membership to a community/group. A user can join or leave these groups on the web (simple checkbox form), or staff can add or remove group membership through the desktop client. By nature of the desktop client, there is the possibility of a data error, ex: populated fieldA and fieldB, but not fieldC. For the web application, upon submitting the form, I'm looping through a list of itemsToAdd and inserting those. In the event that there are bad records because of bad data entry from the desktop client, should I be deleting the to-be-inserted record before inserting? (Please forgive the ham-fisted, partial object orientation of invoking the component for each item.) So, if I call the insert method: cfloop list=#itemsToAdd# index=itemsToAddIndex cfinvoke component=components.myComponent method=insertMethod cfinvokeargument name=fieldA value=#itemsToAddIndex# / cfinvokeargument name=fieldB value=#form.fieldB# / cfinvokeargument name=fieldC value=#form.fieldC# / /cfinvoke /cfloop Should I be calling the delete method first? cfloop list=#itemsToAdd# index=itemsToAddIndex cfinvoke component=components.myComponent method=deleteMethod cfinvokeargument name=fieldA value=#itemsToAddIndex# / cfinvokeargument name=fieldB value=#form.fieldB# / cfinvokeargument name=fieldC value=#form.fieldC# / /cfinvoke cfinvoke component=components.communities method=insertCommunities cfinvokeargument name=fieldA value=#itemsToAddIndex# / cfinvokeargument name=fieldB value=#form.fieldB# / cfinvokeargument name=fieldC value=#form.fieldC# / /cfinvoke /cfloop I've never seen something like this, but it seems like an OK idea. Anyone have a better solution or suggestion? Please note that I have to keep to inserts and deletes; no updates. Thanks for the help. Cameron ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306389 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: One-person shop looking for application developers
Hi Cameron, Are you still looking out for a Coldfusion Developer to develop the projects ? Regards, Mahesh Poojary Subject: One-person shop looking for application developers From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] com Date: Fri, 4 May 2007 14:10:55 -0400 Hi, all. I'm a one-person shop running a CF7-based site. About 60% of my job is management, while the other 40% is programming. That's not enough programming time to get everything done. All of the heavy apps, such as our CMS and our e-commerce modules are commercial apps, supported by established companies. All is well on that front. Where I need help is building the smaller, custom apps that aren't a part of the CMS. These apps are usually data collection apps with back-end management tools. I'm looking for some developers that can do one-time projects: take the specs, build the app, document it, then turn it over to me. While there would definitely be a full spec document and statement of work, most of apps aren't large enough to warrant a full RFP, so it doesn't look like I'd call upon full consulting firms. Or, maybe I would, I'm not sure. Does anyone have any suggestions on where to look for this kind of help? Or, if you are someone who works this way, can you contact me? Thanks for the info. Cameron Johnson Web Director National Association of Independent Schools Washington, DC [EMAIL PROTECTED] ~| Get involved in the latest ColdFusion discussions, product development sharing, and articles on the Adobe Labs wiki. http://labs/adobe.com/wiki/index.php/ColdFusion_8 Archive: http://www.houseoffusion.com/groups/CF-Jobs-Talk/message.cfm/messageid:3440 Subscription: http://www.houseoffusion.com/groups/CF-Jobs-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.11
Re: One-person shop looking for application developers
Hello, Mahesh and everybody. I got a good response from the community, so I'm not looking for any more developers at this time. Thank you, Cameron Johnson Hi Cameron, Are you still looking out for a Coldfusion Developer to develop the projects ? Regards, Mahesh Poojary ~| ColdFusion 8 - Build next generation apps today, with easy PDF and Ajax features - download now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Jobs-Talk/message.cfm/messageid:3441 Subscription: http://www.houseoffusion.com/groups/CF-Jobs-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.11
One-person shop looking for application developers
Hi, all. I'm a one-person shop running a CF7-based site. About 60% of my job is management, while the other 40% is programming. That's not enough programming time to get everything done. All of the heavy apps, such as our CMS and our e-commerce modules are commercial apps, supported by established companies. All is well on that front. Where I need help is building the smaller, custom apps that aren't a part of the CMS. These apps are usually data collection apps with back-end management tools. I'm looking for some developers that can do one-time projects: take the specs, build the app, document it, then turn it over to me. While there would definitely be a full spec document and statement of work, most of apps aren't large enough to warrant a full RFP, so it doesn't look like I'd call upon full consulting firms. Or, maybe I would, I'm not sure. Does anyone have any suggestions on where to look for this kind of help? Or, if you are someone who works this way, can you contact me? Thanks for the info. Cameron Johnson Web Director National Association of Independent Schools Washington, DC [EMAIL PROTECTED] ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Jobs-Talk/message.cfm/messageid:3334 Subscription: http://www.houseoffusion.com/groups/CF-Jobs-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.11
Re: CFQUERYPARAM stripping characters..why?
I'm not sure of the specifics, but to troubleshoot, I'd test it by removing the CFQUERYPARAM and doing the insert. If it is still stripping the characters, it's not CFQUERYPARAM. It's either the form or the DB. Hope that helps, at least a little bit. Cameron I have this code... insert into tblRaters (mgrEmail, raterComments) values (cfqueryparam cfsqltype=cf_sql_varchar value=#arguments. mgremail#, cfqueryparam cfsqltype=cf_sql_varchar value=#arguments. ratingComments# ) When someone inputs into the ratingComments variable, extraneous characters like, (+ sign), the character gets stripped. So a Comment like, he's A+++ is written to the db like he's A. Can someone tell me a way around this? thanks! Chris ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261433 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Fusebox 4.1 setup for a multi-stage app
Hi, all. Here's a question about setting up the directory structure and core files using FB 4.1. I'm creating an app where a mix of users, judges, and adiministrators use different parts of the app during different parts of the year. Stage 1 - users register (Spring) Stage 2 - administrators match registrants to create teams (Summer) Stage 3 - user teams report in (Fall) Stage 4 - judges review reports (Winter) Some of those stages will have their own set of administrative functions, too, so they can clean up data, delete bad entries, create judges, etc. The directory structure will look something like this: Applications - MyApp - stage1 - admin - stage2 - stage3 - admin - stage4 - admin SO! My first big question is: should I use one set of FB core files in the MyApp directory, or should I put the FB core files in each of the stage directories, treating each stage as its own mini-app? If I go with one set of core files, I envision my URLs would look like this: MyApp/index.cfm?fuseaction=stage1.register MyApp/index.cfm?fuseaction=stage1.confirm MyApp/index.cfm?fuseaction=stage1.admin (how do I go one more level, such as stage1.admin.viewRegistration?) If I go with the multiple mini-app aproach, it would be: stage1/index.cfm?fuseaction=user.register stage1/index.cfm?fuseaction=user.confirm stage1/index.cfm?fuseaction=admin.viewRegistration stage1/index.cfm?fuseaction=admin.editRegistration Can someone comment on my approach and/or suggest some better ways to do this? I'm a one-person shop at my office, so I've got no one to help me to bounce ideas. Thank you, thank you. Cameron ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239389 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Fusebox 4.1 setup for a multi-stage app
Got it. Thanks, Brian. I didn't know how to reference those child folders. It appears that circuit aliases are my friends. Thanks for the help. Cameron I don't see any issue with having one set of core files, essentially making your different stages part of a single large application. To get at the second level of your app, (i.e. the admin area) just create a child circuit for the stage and you can reference it like MyApp/index.cfm?fuseaction=stage1child.register. Other than that the general approach sounds fine. On 5/3/06, Cameron Johnson [EMAIL PROTECTED] wrote: ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239439 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Combine or separate GetOne and GetAll queries
Coding convention/best practice question here. In my component, I've got GetOneRecord and GetAllRecords functions. Is it best to combine those functions and use some CFIF logic around a WHERE statement, or should I keep them separate? Here's the combined code: cffunction name=getRecords access=public returntype=query hint=Get one record if recordID is passed, or get all records. output=false cfargument name=recordID type=numeric required=no / cfquery name=getRecords datasource=#DSN# SELECT * FROM table cfif isDefined(arguments.recordID) WHERE recordID = cfqueryparam value=#arguments.recordID# cfsqltype=cf_sql_integer / /cfif ORDER BY recordName /cfquery cfreturn getRecords / /cffunction Thoughts, anyone? Thanks, Cameron ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237140 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Looping over dynamic checkboxes
Thanks for that suggestion, Bobby. I'm still missing something, and I think I've taken a step back. The following code only gives me one checked checkbox when first editing the form and no checked checkboxes during the error checking: cfloop query=getCheckboxes cfset local.currentCheckboxID = getCheckboxes.checkboxID / input name=checkboxList type=checkbox value=#getCheckboxes.checkboxID# cfloop query=queryUser cfparam name=form.checkboxList default=#queryUser.checkboxID# / cfif local.currentCheckboxID EQ form.checkboxList checked /cfif /cfloop /cfloop Something is eluding me. Any other help? Cameron Use the same loop to declare cfparams for your form fields using the query results as the default Then in all of your form fields, use the form scope for the values When the user first hits the form, the query populates the form scope. When the user submits, THEIR information overrides the cfparams and stays in the form scope Works every time :-) (not to mention... it will get rid of all those cfif statements ;-) .:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231648 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Log analyzer software.
Does SmarterStats make it easy to track pages based on URL variables? Like many sites, our whole site is based on: index.cfm?id=1234 article.cfm?id=5678 conference.cfm?id=91011 And, to further complicate, the same item can be called from different directories: /about/article.cfm?id=5678 /resources/article.cfm?id=5678 Cameron Thanks to all that have helped. Looks like SmarterStats is a go. :) Also, from what I hear, their mail software, SmarterMail is pretty good as well. Thanks, Che. -Original Message- From: Justin D. Scott [mailto:[EMAIL PROTECTED] Sent: Monday, February 06, 2006 8:48 PM To: CF-Talk Subject: RE: Log analyzer software. I'd like some recommendations on web log analyzer software. I'm a little late on the discussion, so apologies if someone has already mentioned this. I personally prefer SmarterStats. It has a clean interface, scales well, and supports auto-login from client site admin consoles and such. It's easy to create sites, and then let the user see whatever reports they want. It will even remove the log files after a specified period of time to keep your drive from filling up. All around a great product with a great price tag compared to some of the others out there. http://www.smarterstats.com/ -Justin Scott ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231654 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Looping over dynamic checkboxes
The scenario: I've got a self-posting form that validates against validateForm.cfm. If there are errors in the form, I declare an error message variable and put in some text: cfset errorMessage = There were errors in your submission. The purpose: If there are errors, I want the form to be populated with the form scope, instead of the query scope, so that the user doesn't have to retype everything. If there are no errors, use the query results: cfif isDefined(errorMessage) input type=Text name=userFirstName value=#form.userFirstName# cfelse input type=Text name=userFirstName value=#queryUser.userFirstName# /cfif The problem: I've got a set of dynamic checkboxes from the query getCheckboxes with the input name of checkboxList. Just like in the code above, I want to check the checkboxes with the form scope if there are errors. But, of all the ways I've tried, I can't get the checkboxes to check: cfloop query=getCheckboxes cfset local.currentCheckboxID = getCheckboxes.checkboxID / cfif isDefined(errorMessage) input name=checkboxList type=checkbox value=#getCheckboxes.checkboxID# cfloop ??? cfif ??? EQ local.currentCheckboxID checked /cfif /cfloop cfelse input name=checkboxList type=checkbox value=#getCheckbox.checkboxID# cfloop query=queryUser cfif queryUser.checkboxID EQ local.currentCheckboxID checked /cfif /cfloop /cfif /cfoop What should I loop over and what should my comparison value be? I'm out of ideas. Thanks for the help. Cameron ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231620 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Capture CF Admin settings
Hi, all. Rather than taking screen shots or saving each page as an HTML file, is there a way to capture and store all of the CF Admin settings? Doing a CF reinstall without properly document settings is a pain and I'm looking for some pain relief. Thanks, Cameron ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230970 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Capture CF Admin settings
Thanks for that suggestion. (And that led me to a previous post of yours with this answer. Sorry for the repeat.) But it looks like that function is only on Enterprise. We're running MX 6.1 Standard. Cameron I belive you could export it as a CAR file Hope that helps MD On 01/02/06, Cameron Johnson [EMAIL PROTECTED] wrote: ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230979 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
CFC forms and error handling
Hi, all. I've checked the forums for similar posts, but I've not found a clear answer. So, this may be a bit of a repeat. I've got a simple CFC consisting of four files: form.cfm, formAction.cfm, testCFC.cfc, show.cfm. In formAction.cfm, I wrap the cfinvoke in a cftry to catch any database errors: cftry cfinvoke component=testCFC method=insertRecord returnvariable=newRecordID argumentcollection=#form#/cfinvoke cflocation url=show.cfm?id=#newRecordID# addtoken=No / cfcatch type=Database ERROR! /cfcatch /cftry I purposely cause an error by trying to insert a string value into an integer field. Question: once I catch the error, how do I get the user back to the form and populate the form fields with what the user has already typed in? One post recommended putting all the form fields in the session scope, then populating the form with session variables. But, that seems very cumbersome. Thanks for the help, Cameron ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216274 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Best Practice with CFC?
I can't answer the should/best practice part of that question, as I've wondered the same thing. But, here's a blog entry that may help answer the how part of the question: http://www.talkingtree.com/blog/index.cfm?mode=entryentry=0C4FAED9-50DA-0559-A0DF9DC0609CF2DF Cameron ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:215764 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: filtering results based on url variables
In case anyone is interested, or if someone digs into the archives for this topic, a friend helped me work out a javascript solution. The function basics are: InvalidTag var urlfield= 'cfoutput#url.field#/cfoutput; function filter(param, value) { switch (param) { case 'field' : urlfield = value; break; } location.href=page.cfm?field= + urlfield; } /script The links on the page are: a href=## onclick=filter('field', 'value1'); return false;value1/a ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213875 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
filtering results based on url variables
Using a CFC, I've got a table of results from a getAllRecords method. I want to filter those results based on some variables that the user clicks on individually. So, in the getAllRecords method, my SELECT query will be: SELECT * FROM table WHERE value1 = #arguments.value1# cfif isDefined(arguments.value2) AND value2 = #arguments.value2#/cfif cfif isDefined(arguments.value3) AND value3 = #arguments.value3#/cfif (cfqeryparam eliminated for this post. Rest assured, I'm using it.) My question is, what's the most efficient way to collect and pass those three variables as a group? At first, I created a variable called URLVariables, and appended each variable as the user clicked each one. That was nice, in that the user could build up multiple filters with a few clicks. And, that saved time when adding new filters, in that I did not have to change each link on the page and add a new variable to a long list of varbiales joined by . However, that left me open to doubling-up on one variable, hence getting and illegal WHERE clause: WHERE value2 = A, B (value2 is an integer) There has to be a better way to do this. Any thoughts or experiences to speak of? Thanks, Cameron ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213419 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
cfif with AND and OR statements
I've got the following cfif statement in one of my header pages: cfif (isDefined(URL.ItemNumber) AND URL.ItemNumber NEQ 12345) OR (CGI.SCRIPT_NAME NEQ '/page.cfm') show table 1 cfelse show table 2 /cfif Here are my scenarios: - when the cfif is combined into one statement, it works correctly (meaning I see table 2) when browsing to /page.cfm. But it doesn't work when browsing to index.cfm?ItemNumber=12345 - if I split the statement into two cfif statements, I see table 2 on both /page.cfm and index.cfm?ItemNumber=12345 Any ideas why it's not working on index.cfm?ItemNumber=12345 when the statement is combined? Is something wrong with the cfif that I'm not seeing? Appreciate the help. - Cameron ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207652 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: cfif with AND and OR statements
Mapping out the givens and the cases like that made me see the hole in the logic. I flipped the statement and it works in both cases: cfif CGI.SCRIPT_NAME EQ '/page.cfm' OR (isDefined(url.ItemNumber) AND url.ItemNumber EQ 12345) show table 2 cfelse show table 1 /cfif Issue resolved. Thanks for the help and for the new mode of thinking. - Cameron Your right it is and thus the true clause would run. Apparently it was too early in the morning for me to be doing Boolean logic. Corrected results below. . IF (A AND B) OR C . IF (F AND F) OR F . IF F OR F . FALSE Clause Run . . CASE 2 . url.itemNumber = 12345 . cgi.ScriptName = 'index.cfm' . . IF (A ND B) OR C . IF (T AND F) OR T . IF F OR T . TRUE Clause Run -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning . -Original Message- . From: Dave Francis [mailto:[EMAIL PROTECTED] . Sent: Wednesday, May 25, 2005 8:57 AM . To: CF-Talk . Subject: RE: cfif with AND and OR statements . . Isn't CASE 2, condition C True? ie. index.cfm NEQ page.cfm Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207669 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54