coldfusion

ColdFusion isDefined

孤人 提交于 2019-12-19 03:16:50
问题 I am trying to check to see if data exist in my form If data does not exist I want to assign it to O. How can I do this. <cfif not isDefined("FORM.Age")> cfset FORM.Age = "0" <cfif> 回答1: Generally the best practice is considered to be to avoid isDefined. This is because isDefined will search all scopes until it finds a matching variable. So it's more efficient to use structKeyExists, eg: <cfif NOT structKeyExists(form, "age")> <cfset form.age = 0> </cfif> Also, another way to achieve this is

Using a colon with named arguments in ColdFusion

南楼画角 提交于 2019-12-19 02:07:14
问题 I saw this code example in a recording and wanted to know what the colon syntax did. I searched the docs, but I wasn't able to find any info on it: weather.subscribe(observer: application.observers.currentConditions); I know we can use colon in CF9 for ternary operators: result = (condition) ? true : false; But in this case it looks like it's being used to provide named arguments; so what's it doing there? 回答1: <cfset result = obj.func(arg:value,thing:42) /> I looked at this and went blink,

JavaScript/jQuery VIN Validator

筅森魡賤 提交于 2019-12-19 02:06:34
问题 Has anyone ever created a VIN Validator? I am trying to create a textbox where the user will enter in a Vehicle Identification Number and then JS/jQuery will validate if its correct or not in case they mistype the number. I am very new to JS/jQuery and have found some examples but of course have not been able to get them to work correctly... Any one with any ideas or suggestions it would be greatly appreciated, especially if you can tell me how to set up what I have below to work properly!

how to loop through Query Columns in ColdFusion

被刻印的时光 ゝ 提交于 2019-12-18 19:41:12
问题 I have a query in a my CFC. The function contains a simple query as such. <cfquery name="qrySE" datasource=#mydatasource#> SELECT NAMES,SALARY FROM tblTest </cfquery> I want to display my resultset as such (horizontally): NAME1 NAME2 NAME3 NAME4 10 20 45 62 Is there a way to loop through the columns of my query and create a virtual query for this purpose? If anyone has done this, please let me know. 回答1: Just wanted to add Al Everett's solution returns the columns back in alphabetical order.

How to override SQL sanitization in ColdFusion

浪子不回头ぞ 提交于 2019-12-18 16:59:21
问题 I have the unfortunate task of cleaning up a bunch of old ColdFusion code. Queries are all over the place, I am working on moving them all to common CFCs for easier maintenance. I am running into a problem because cfquery is automatically converting the single quotes to double-single-quotes. How can I override that behavior? More specific information is below. So here is the query I started with: <cfquery name="getObjectInfo" datasource="#BaseDS#"> SELECT groupName AS lastname, '[Group]' AS

ColdFusion: Get variable type

倖福魔咒の 提交于 2019-12-18 12:47:36
问题 The ColdFusion <cfdump /> tag is giving me much less information than the PHP function var_dump() . Is there any other possibility in CF to find out of what type (integer, string etc.) my variable is? 回答1: CFML is dynamically typed, so types can change as required. You can see the current (JVM) type of a variable by doing <cfdump var=#getMetadata(var)# /> or simply by accessing getMetadata(var).getName() . Generally, you don't care whether something is a specific type, so much as whether it

Coldfusion Error and IIS7.5 Error Pages

女生的网名这么多〃 提交于 2019-12-18 11:57:43
问题 In order to allows ColdFusion showing its errors instead of just server error (code 500), I have added to web.config according to some findings in this site. The problem looks resolved but... When I visit a non-existed directory in the IIS, it returned a "blank" page without any status code. If I set it from passthrough back to auto, the IIS takes the error page again and no more ColdFusion errors showed. Anyone has a solution? I did some research and "suspect" that the JWildcardhandler maybe

Coldfusion Error and IIS7.5 Error Pages

独自空忆成欢 提交于 2019-12-18 11:57:16
问题 In order to allows ColdFusion showing its errors instead of just server error (code 500), I have added to web.config according to some findings in this site. The problem looks resolved but... When I visit a non-existed directory in the IIS, it returned a "blank" page without any status code. If I set it from passthrough back to auto, the IIS takes the error page again and no more ColdFusion errors showed. Anyone has a solution? I did some research and "suspect" that the JWildcardhandler maybe

Iterate through a dynamically created table and Insert data into SQL Server table

雨燕双飞 提交于 2019-12-18 09:42:54
问题 I have a dynamically created table in an .html form and I want to do an insert in the .cfm form. I need to loop through the rows of the dynamically created table and perform an INSERT into a table in SQL Server. Also, the table was created in JavaScript. Thanks. <cfoutput> <cfloop from="1" to="#ArrayLen(tblSample)#" index="i"> <cfquery name="AppendForm" datasource="TestSource"> INSERT INTO tblGrand (GrandNum, GrandName, County, VersionType, VersionNum, SectCode, Comments, Provider, TypeID,

advantage of REST in CF10 vs invoking remote method through ajax?

白昼怎懂夜的黑 提交于 2019-12-18 09:37:45
问题 Have anyone used REST in CF10 for production? How is that better then ajax calling remote method, e.g. foo.cfc?method=blah ? Can you get your RESTful API pure stateless? Do you still rely on session cookie? 回答1: REST and remote calls to a method are two entirely different options, neither of which are necessarily "better". REST services in CF are stateless by default. It's really up to you if you want to get sessions involved or any other state for that matter. I would suggest reading more