是否可以在html中引用cf变量?例:
<cfset langValue ="uk">
<html lang="#langValue#">
Run Code Online (Sandbox Code Playgroud)
这种方式不起作用,但如果我用cf标签打印它显然有效:
<cfoutput> #langValue# </cfoutput>
Run Code Online (Sandbox Code Playgroud)
有没有怎么引用langValuehtml lang标签中的变量?
我收到以下错误,无法弄清楚原因:
执行数据库查询时出错.[Macromedia] [SQLServer JDBC驱动程序] [SQLServer]')'附近的语法不正确.错误发生在第141行.
<cfquery datasource="mySource" name="getTravel">
select traveler, customernumber, destination, tripdate, purpose, empid, pm_reportid, company
from mySource.dbo.PM_Travel
where pm_reportid in
(
<cfloop from="1" to="#getRecentReports.recordcount#" index="i">
<cfif i lt getRecentReports.recordcount>
#getRecentReports.pm_reportid[i]#,
<cfelse>
#getRecentReports.pm_reportid[i]#
</cfif>
</cfloop>
)
order by customernumber
</cfquery>
Run Code Online (Sandbox Code Playgroud)
第141行是:
where pm_reportid in (<cfloop from="1" to="#getRecentReports.recordcount#" index="i"><cfif i lt getRecentReports.recordcount>#getRecentReports.pm_reportid[i]#, <cfelse>#getRecentReports.pm_reportid[i]#</cfif></cfloop>)
Run Code Online (Sandbox Code Playgroud)
这不是我写的,我是CF的新手.任何帮助表示赞赏.
我从客户端接收到如下格式的XML字符串...
<root>
<result success="1"/>
<userID>12345</userID>
<classID>56543</classID>
</root>
Run Code Online (Sandbox Code Playgroud)
我需要将此字符串压缩为以下内容...
<root><result success="1"/><userID>12345</userID><classID>56543</classID></root>
Run Code Online (Sandbox Code Playgroud)
因此,除去了标记内部的所有空白(因此在“结果”和“成功”之间仍然存在该空格)。
我已经使用replace语句删除了换行符,回车符等,但是在忽略标记内的空格时无法删除空格。有没有办法使用正则表达式或其他方法来完成此任务?
出于某种原因,当通过solr集合解析得到Coldfusion时,我得到了<cfquery>标记内的SQL查询文本.有什么办法可以防止这个?
我有一个很好的搜索,看看是否有类似于我想要做的事情.没有什么特别涵盖它,尽管没有进一步的麻烦.
我希望我的cfloop能够在搜索页面上的任何复选框中工作,并显示从数据库中提取的相应结果.这是我到目前为止:
<cfquery name="joblibrary">
SELECT *
FROM tblJobLibraryRoles JOIN tblJobLibraryCategories
ON tblJobLibraryRoles.category = tblJobLibraryCategories.id
<cfloop list="#form.cbGrade#" index="i">
WHERE grade=<cfqueryparam cfsqltype="cf_sql_varchar" value="#i#"/>
</cfloop>
ORDER BY category, grade, title, heraRef;
</cfquery>
Run Code Online (Sandbox Code Playgroud)
现在,所有工作正常,如果只有一个复选框被选中,所以我基本上是问我能得到这个类型CFLOOP在我创建它在上班的路上,还是我找错了树?
我正在尝试为cffile上传做一个例外,以确保用户只上传xls相关文档或根本不上传.我有文件上传的问题.即使用户可能没有将任何内容附加到输入,表单仍将通过并假设表单字段b1b3formAttach定义.这是代码:
<cfif structKeyExists(form, "Submit")>
<cfif isDefined("Form.b1b3formAttach") >
<cffile action = "upload"
fileField = "b1b3formAttach"
destination = "#GetTempDirectory()#"
nameConflict = "overwrite">
<cfif isDefined("CFFILE.serverFile")>
<cfset session.slot = cffile.serverFile>
<cfelse>
<cfset form.storage = "">
</cfif>
</cfif>
<body>
<label class="control-label" for="b1b3formAttach">Attach the completed B1/B3 Form*</label></br>
<div class="controls">
<input id="b1b3formAttach" name="b1b3formAttach" class="input-file" type="file">
</div>
<div class="controls">
<button value="Submit" type="submit" id="Submit" name="Submit" class="btn btn-default">Submit</button>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
错误简述:
The form field b1b3formAttach did not contain a file.
The error occurred in C:/ColdFusion11/cfusion/wwwroot/wwwroot/form.cfm: line 21
19 : fileField …Run Code Online (Sandbox Code Playgroud) 我试图NumberFormat在一个整数上使用,以便用前导零填充它.不幸的是,NumberFormat似乎对整数没有影响.任何意见,将不胜感激.
<cffunction name="myFunction" access="remote" returntype="numeric">
<cfargument name="myId" type="numeric" required="yes" />
<cfquery name="myQuery">
SELECT COUNT(fileid) AS itemCount FROM files
WHERE directory = '#myId#'
</cfquery>
<cfset newId = numberFormat( myQuery.itemCount, '0000000' )>
<cfreturn newId />
</cffunction>
Run Code Online (Sandbox Code Playgroud) 我的老板突然去世了,留下了很少的笔记和信息,在我和他一起工作的时候并没有和我分享太多.他已经在这里待了29年,因此向他提供了大量信息.
他在这里的一个项目是ColdFusion服务器v9和他编写的许多用户所依赖的应用程序.他喜欢编写代码,到目前为止我发现了5种不同的语言,我不是那么多,我知道一点.我的问题是......要保持他的应用程序运行,直到我找到替换它们,是否有一个Web内容编辑软件与ColdFusion服务器一起使用,或者我只是要拔掉他的应用程序的插件当他们休息?
我找到了Adobe Flex Builder 2 CD和Adobe Creative Suite 3 Web标准CD.对我来说有什么价值?看起来它们是旧版本.有250个用户和设备,网络等照顾我有点忙.非常感谢有关此的任何信息.
我有这个脚本在ColdFusion中生成一个条形码:
<cfscript>
code128 = createobject("java","com.lowagie.text.pdf.Barcode128");
code128.setCodeType(code128.CODE128);
/* Set the code to generate */
code128.setCode("123")
color = createobject("java","java.awt.Color");
image = code128.createAwtImage(color.black, color.white);
bufferedImage = createObject("java", "java.awt.image.BufferedImage");
bufferedImageType = bufferedImage.TYPE_BYTE_GRAY;
bufferedImage = bufferedImage.init(image.getWidth(JavaCast("null", "")),image.getHeight(JavaCast("null", "")), bufferedImageType);
graphics2D = bufferedImage.createGraphics();
graphics2D.drawImage(image,0,0,JavaCast("null", ""));
barcodeImage = imageNew(bufferedImage);
</cfscript>
<!--- Output the code as an image --->
<cfimage action="writeToBrowser" source="#barcodeImage#" format="jpg" width="100" height="30">
Run Code Online (Sandbox Code Playgroud)
我想改变code128.setCode("123")一些动态的东西,即code128.setCode("#someID#").但是,当我这样做时,我收到一个CF错误:
错误消息:没有具有指定方法名称和参数类型的方法,或者setCode方法使用ColdFusion无法可靠解密的参数类型重载.ColdFusion找到了0个与提供的参数匹配的方法.如果这是一个Java对象并且您验证了该方法存在,请使用javacast函数来减少歧义.
有人可以帮我这个吗?
我正在使用ColdFusion和SQL Server.我想把它转换Due_Date成MM/DD/YYYY.
我打电话是这样的:
<cffunction name="displayTable" access="public" returntype="query">
<cfquery name="processTable">
SELECT id, Date_Due, Date_Complete, Item_Count
FROM dbo.Dealer_Track_Work
</cfquery>
<cfreturn processTable>
</cffunction>
Run Code Online (Sandbox Code Playgroud)
我尝试了许多与此类似的组合:
<cffunction name="displayTable" access="public" returntype="query">
<cfquery name="processTable">
SELECT id, LEFT(CONVERT(VARCHAR, Date_Due, 120), Date_Complete, Item_Count
FROM dbo.Dealer_Track_Work
</cfquery>
<cfreturn processTable>
</cffunction>
Run Code Online (Sandbox Code Playgroud)
谁能发现我可能出错的地方?我在想,因为数据库被设置为datetime,这是转换为varchar,但我仍然无法提出正确的组合.(我不允许更改表格)非常感谢任何帮助我的输出读取MM/DD/YYYY.
coldfusion ×10
mysql ×2
sql-server ×2
apache-flex ×1
cffile ×1
cfml ×1
coldfusion-9 ×1
flexbuilder ×1
regex ×1
solr ×1
upload ×1
validation ×1