我得到了一个带方形单选按钮的设计.

有没有办法将单选按钮设置为这样?
唯一的方法,我认为我可以通过使用图像来实现这一点,并通过一种$.on('click')方法交换已检查/检查状态.
使用数组表示法在用于保留键大小写的结构中创建键。
<cfset var response = structNew()>
<cfset response[ "error" ] = 0>
<cfset response[ "message" ] = "">
<!--- this worked when converting this struct to a JSON
Run Code Online (Sandbox Code Playgroud)
所以当我实际将一些数据放入结构中时:
<cfset response.error = 1>
<cfset response.message = "There was an error inserting the record...">
Run Code Online (Sandbox Code Playgroud)
当我在 Firebug 控制台上看到这个时,我感到很惊讶:
{"MESSAGE":"There was an error inserting the record...","ERROR":1}
请注意,这些信息是我期望看到的。
我知道我是否会使用<cfset response.error = 0>, 来避免在将其转换为 JSON 时不保留的情况,但这在过去对我有用。我是否做错了什么而我视而不见,或者CF10中做了什么改变?
编辑:
在所有回复回来之前,我尝试了大家所说的。
<cfset response["error"] = 1>
<cfset response["message"] = "There was an error inserting the record...">
Run Code Online (Sandbox Code Playgroud)
它起作用了。所以,我猜他们改变了 …
我正在尝试编写一个查询来根据许多不同的范围来计算记录数.
我使用成功union,但我觉得有更好的方法.
这就是我所做的:
select count(col1) as range1
from tbl1
where col1 <= 15000
union
select count(col1) as range2
from tbl1
where col1 > 15001 and col1 <= 30000
union
select count(col1) as range3
from tbl1
where col1 > 30001 and col1 <= 45000
etc...
Run Code Online (Sandbox Code Playgroud)
我正在使用sql server 2008.就像我上面所述,我很肯定有更好的方法来做到这一点,也许是这样的:sql count,
编辑:是的,数据库是sql 2008,下面的答案完全按照需要工作.我忘了提到我实际上是在读一个通过coldfusion 的JSON文件.所以在db中,下面的所有内容都能正常工作,但查询的coldfusion查询不支持该语句,或者它看起来不支持.serializedserializeJSONCASE
我试图将我的应用程序中的某些页面转换为使用cfc,并且一个页面使用存储过程来检索几组数据.
现在,当我访问结果时,它们的行为就像我使用了一个<cfquery>标签,以及所有的功能.所以现在我正在尝试在我正在构建的cfc中使用相同的存储过程,并且我希望能够以相同的方式访问结果,并且存在我的问题.我不知道如何从函数返回多个查询,而不创建我已经开始的数组.顺便说一句,功能是不完整的.我只想努力工作.在下面的设置中,我得到了一个查询对象数组,但我觉得有更好的方法可以做到这一点.
这是<cffuntion>:
<cffunction name="getProfileData"
access="public"
output="false"
returntype="string">
<cfargument name="cusip" type="string" required="true">
<cfargument name="report_date" type="date" required="true">
<cfset var errorMessage = "everything is good">
<cftry>
<cfstoredproc datasource="#dsn#" procedure="prc_asset_profile_retrieve">
<cfprocparam type="in" cfsqltype="cf_sql_varchar" value="#cusip#" dbvarname="@cusip">
<cfprocparam type="in" cfsqltype="cf_sql_varchar" value="#report_date#" dbvarname="@reportDate">
<cfprocresult name="profile_head" resultset="1">
<cfprocresult name="attribution" resultset="2">
<cfprocresult name="characteristics" resultset="3">
<cfprocresult name="exposure" resultset="4">
<cfprocresult name="weights" resultset="5">
<cfprocresult name="holdings" resultset="6">
</cfstoredproc>
<cfset var profileArray = []>
<cfset #ArrayAppend(profileArray,profile_head)#>
<cfcatch type="any">
<cfset errorMessage = "something happened">
</cfcatch>
</cftry>
<cfreturn profileArray>
</cffunction>
Run Code Online (Sandbox Code Playgroud)
当我输出一些测试数据时,它会匹配 …
出于某种原因,一段在*.cfm页面上正常工作并且在a中工作正常的代码*.cfc现在在检测到错误时抛出错误.
错误是:
Element SQL is undefined in CFCATCH.
Run Code Online (Sandbox Code Playgroud)
这个抛出的代码块看起来像这样:
<cfcatch type="database">
<cfset errorMessage = "
<p>#cfcatch.message#</p>
<p>Please send the following to a developer:</p>
<p>#cfcatch.SQL#</p> <--- ERROR HERE
<p>#cfcatch.queryError#</p>
<p>#cfcatch.Where#</p>">
some other stuff
</cfcatch>
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?
UPDATE
使用@BenKoshy建议,我修改了我的<cfcatch>陈述.
还记得KISS吗?保持简单愚蠢
使用他的方法,然后修改它,我得到的数据比我使用的更多,所以我选择了一个简单的版本,它的工作方式与广告一样.
<cfif isDefined("cfcatch.message")>
<cfset errorMessage = errorMessage & "<p>#cfcatch.message#</p>">
</cfif>
<cfif isDefined("cfcatch.SQL")>
<cfset errorMessage = errorMessage & "<p>Please send the following to a developer:</p><p>#cfcatch.SQL#</p>">
</cfif>
<cfif isDefined("cfcatch.QueryError")>
<cfset errorMessage = errorMessage & "<p>#cfcatch.queryError#</p>">
</cfif>
<cfif isDefined("cfcatch.Where")>
<cfset …Run Code Online (Sandbox Code Playgroud) 我有一个包含下拉列表的页面,当用户从列表中选择一个选项时,会触发一个ajax调用并创建一系列复选框.有些是经过检查,有些则未经过检查.我需要记录是否对复选框进行了任何更改,即选中/取消选中.我尝试使用以下内容,但没有任何反应.
我正在使用jQuery版本1.7.1,顺便说一句.
$("input:checkbox").change(function(){
//some stuff happens
});
Run Code Online (Sandbox Code Playgroud)
我在那里有一个警报,但什么也没发生.所以我试着将它包装成一个$(document).ready(...但是没有.所以我的猜测是,由于在DOM准备就绪时尚未创建复选框,因此没有标记将该操作附加到.
所以现在我不知所措.我不知道,没有把onChange="someFunction()"成
.append("<input type='checkbox' id='" + theData.DATA + "' value='" + theData.DATA + "'>" + tempName + "<br />");
Run Code Online (Sandbox Code Playgroud)
这实际上是创建复选框.
有什么想法吗?
这是小提琴:http://jsfiddle.net/rbmako69/t5qKs/12/
这是表格:
<form id="form1" mrthod="get" action="#">
<div date-role="fieldcontain" class="ui-hide-label">
<label for="best_contact_method">Best Contact Method</label>
<select data-theme="a" id="best_contact_method" name="best_contact_method" class="required" data-native-menu="false">
<option>Best Contact Method</option>
<option value="email">Email</option>
<option value="daytime_phone">Daytime Phone</option>
<option value="evening_phone">Evening Phone</option>
</select>
</div>
<div data-role="fieldcontain" class="ui-hide-label">
<label for="daytime_phone" id="daytime_phone_label">Daytime Phone</label>
<input type="text" id="daytime_phone" name="daytime_phone" placeholder="Daytime Phone" />
</div>
<div data-role="fieldcontain" class="ui-hide-label">
<label for="evening_phone" id="evening_phone_label">Evening Phone</label>
<input type="text" id="evening_phone" name="evening_phone" placeholder="Evening Phone" />
</div>
<div data-role="fieldcontain" class="ui-hide-label">
<label for="email" id="email_label">Email</label>
<input type="text" id="email" name="email" placeholder="Email" />
</div>
<button type="submit" …Run Code Online (Sandbox Code Playgroud) 我一直在尝试创建一个数据结构,但我很难过.我正在尝试创建这样的数据结构:
{
"vehicle": [
{
"inv_id": "123412",
"year": "2013",
"make": "Jeep",
"model": "Grand Cherokee"
},
{
"inv_id": "1224522",
"year": "2013",
"make": "Jeep",
"model": "Grand Cherokee"
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是我试过没有运气的事情.
<cfset result["vehicle"] = []>
<cfoutput>
<cfloop query="qinv">
#arrayAppend("result.vehicle,{})#
<cfloop array="#result.vehicle#" index="i">
#structInsert(result.vehicle[i], "inventory_id", qInv.inventory_id)#
#structInsert(result.vehicle[i], "year", qInv.year)#
#structInsert(result.vehicle[i], "make", qInv.make)#
#structInsert(result.vehicle[i], "model", qInv.model)#
</cfloop>
</cfloop>
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
这是The value coldfusion.runtime.Struct cannot be converted to a number.在第一个structInsert行上抛出coldfusion错误.
有什么建议?
我有一个使用jQuery来调用cfc的CF应用程序$.post.我在cfc中有错误处理,但是如何捕获这个例子:
CFC:
<cfcomponent>
<cffunction name="function_1" access="remote" returnformat="json">
...
</cffunction>
....
</cfcomponent>
Run Code Online (Sandbox Code Playgroud)
呼叫页面:
<html>
<head>...</head>
<body>...
<script>
$.post("mycfc.cfc",{
method: "functio_1", //notice the misspelling
....
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这不会导致javascript错误,并返回200响应.
错误将是:
The method functio_1 was not found in component E:\inetpub\wwwroot\mycfc.cfc. Ensure that the method is defined, and that it is spelled correctly. <br>The error occurred on line -1.
Run Code Online (Sandbox Code Playgroud)
我知道这是一个基本的例子,很容易修复,但我确信还有很多其他例子可能会发生类似的事情.
有什么想法吗?
我有一组包含在<cftransaction>块中的插入,我收到错误并且正在回滚插入.
以下是有关空间的问题代码:
<cffunction name="InsertTCUV" access="public">
<cfargument name="vehicle required="true" type="xml" />
//Parsing the xml document here
<cftransaction>
<cfquery name="TCUVinsert datasource="mydb">
INSERT INTO tcuv
VALUES(...)
<cfquery>
<cfquery name="qLatestTCUVID" datasource="mydb">
SELECT TOP 1 tcuv_id FROM dbo.tcuv ORDER BY tcuv_id DESC
</cfquery>
<cfset curTCUVID = qLatestTCUVID.tcuv_ID>
<cfset optionsResult = insertOptions(curTCUVID,vehicle>
<cfset imagesResult = insertImages(curTCUVID,vehicle)>
<cfset standardFeaturesResult = insertStandardFeatures(curTCUVID,vehicle
</cftransaction>
</cffunction>
<cffunction name="insertOptions" access="private">
<cfargument name="TCUVID required="true type="numeric" />
<cfargument name="vehicleInfo" required="true" type="xml" />
<cfset var result = "good">
<cftry>
<cfset optionNode = …Run Code Online (Sandbox Code Playgroud) 我正在使用cfscript语法创建一个查询,我有两个日期查询参数.我第一次使用时创建了日期字符串
queryservice.addParam(
name="last_update",
value="createODBCDate(now())",
cfsqltype="cf_sql_date");
Run Code Online (Sandbox Code Playgroud)
我认为这可以类似于:
<cfqueryparam value="#createODBCDate(now())#" cfsqltype="cf_sql_date">
Run Code Online (Sandbox Code Playgroud)
所以,当我运行查询时,我得到:
The cause of this output exception was that: coldfusion.runtime.Cast$DateStringConversionException: The value createODBCDate(now()) cannot be converted to a date.
Run Code Online (Sandbox Code Playgroud)
精细.所以我创建了一个变量,
var currentDate = createODBCDate(now());
Run Code Online (Sandbox Code Playgroud)
把它添加到
queryservice.addParam(
name="last_update",
value="createODBCDate(now())",
cfsqltype="cf_sql_date");
Run Code Online (Sandbox Code Playgroud)
得到了
The cause of this output exception was that: coldfusion.runtime.Cast$DateStringConversionException: The value currentDate cannot be converted to a date.
Run Code Online (Sandbox Code Playgroud)
当我使用标准<cfquery ...语法创建查询时,它工作正常.
所以,我假设我做错了什么,但我不能为我的生活找出那是什么.
顺便说一句,这是我第一次尝试使用<cfscript>语法创建查询.
我需要先在列表中显示一组结果,然后从下表中显示其余结果.
我已经尝试过SQL:如何使用UNION并通过特定的选择进行排序?但它似乎不适用于我的情况.
我的查询看起来像这样
SELECT * FROM (
SELECT id, display as ordered
FROM table
WHERE id in (...) --these need to be first
UNION
SELECT id, display
FROM table
WHERE id not in (...) --these need to be at the end
)
ORDER BY ordered
Run Code Online (Sandbox Code Playgroud)
无论我做什么,我的结果都会以显示顺序返回.
我正在使用Oracle,顺便说一句.
谢谢您的帮助.
我从oracle db返回一些数据,并且a字段使用ascii单元分隔符'31'.我需要在单位分隔符后得到一个数值.我试过了value.charCodeAt(31),但它正在回归NaN.
我正在使用的字符串是3012(31)1parens中的31是单位分隔符的位置.
这是控制台中的样子
奇怪符号后面的值可以是从-1到n的任何数字.
任何帮助,将不胜感激.
coldfusion ×8
jquery ×4
cfc ×2
sql ×2
ajax ×1
ascii ×1
coldfusion-9 ×1
css ×1
css3 ×1
javascript ×1
oracle ×1
sql-server ×1