小编Ali*_*ias的帖子

停止选择多个单选按钮

我在页面顶部有一个单选按钮,显示"No Chosen Supplier",然后在查询循环中显示其他几个单选按钮.

<label>
  <input type="radio" id="nosupp" name="nosupp" onchange="resetSupp(this);">
    No Supplier Chosen
</label>

<cfloop query="supplier"
  <label>
    <input type="radio" id="chk1" name="chooseSupp" onchange="change(this);">
    Chosen Supplier
  </label>
</cfloop>
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是,如果我在循环中选择一个单选按钮,然后选择循环外的单选按钮,循环内的单选按钮将保持与外部单元同时选中.

如何获得它,以便在选择外部时,内部的一个被取消选择?

希望这是有道理的.

javascript coldfusion radio-button dom-events

5
推荐指数
1
解决办法
6876
查看次数

SQL - 围绕AND的IF语句

我正在尝试创建一个只会在满足某些条件的情况下添加AND子句的查询.

这就是我所追求的:

SELECT DISTINCT
  id
  name
  active
FROM team
WHERE id = 1234
IF team.active = 'y'
  AND team.id IN
    {
       query
    }
ELSEIF team.active = 'n'
  AND team.id IN
    {
      query
    }
Run Code Online (Sandbox Code Playgroud)

但我不确定如何在SQL中执行此操作.有什么建议?

sql if-statement sql-server-2008

4
推荐指数
1
解决办法
136
查看次数

这种数组是什么意思/做什么的?

我在一个涉及拼图的代码中发现了这个声明,有人能解释它在做什么吗?我试过看自己,但我真的不明白.

test = [[0] * 9] * 9
Run Code Online (Sandbox Code Playgroud)

python arrays python-2.7

3
推荐指数
1
解决办法
111
查看次数

使用dataformat时逗号无效

这是我将查询输出到电子表格的代码.

<cfscript> 
  //Use an absolute path for the files. ---> 
  theDir=GetDirectoryFromPath(GetCurrentTemplatePath()); 
  theFile=theDir & "getTestInv.xls"; 
  //Create an empty ColdFusion spreadsheet object. ---> 
  theSheet = SpreadsheetNew("invoicesData"); 
  //Populate the object with a query. ---> 
  SpreadsheetAddRows(theSheet,getTestInv);
</cfscript>

<cfset format = StructNew()>
<cfset format.dataformat = "#,###0.00">
<cfset SpreadsheetFormatColumn(theSheet,format,10)

<cfspreadsheet action="write" filename="#theFile#" name="theSheet" sheetname="getTestInv" overwrite=true>
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

Invalid CFML construct found on line 125 at column 32.
ColdFusion was looking at the following text:

,

The CFML compiler was processing:

An expression beginning with /", on line …
Run Code Online (Sandbox Code Playgroud)

coldfusion dataformat export-to-excel coldfusion-10 cfspreadsheet

2
推荐指数
1
解决办法
320
查看次数

选择min,max,avg,WHERE

我正在使用MySQL.

我正在尝试选择字段的最小,最大和平均长度,但我不确定如何.像这样的东西:

SELECT 
  min as min,
  max as max,
  avg as avg
FROM COLUMNS
WHERE COLUMN_NAME like '%password%'
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

mysql sql where

1
推荐指数
1
解决办法
3038
查看次数

从列表中选择AZ

我有一个项目列表,并希望为用户提供跳转到他们想要的字母的选项.

例如,屏幕顶部的字母AZ,当用户点击B时,它将它们带到列表的一部分,第一个项目以B开头.

有没有办法用ColdFusion做到这一点?

我的列表使用查询填充.

<table border="1"> 
  <tr> 
    <th>Names</th> 
    <th>Other Stuff</th> 
  </tr> 

<cfoutput query="getnames"> 
  <tr> 
    <td> 
      <li>#getnames.names#</li> 
    </td> 
    <td> 
    <li>#getnames.otherstuff#</li> 
    </td> 
  </tr> 
</cfoutput>
</table>
Run Code Online (Sandbox Code Playgroud)

coldfusion list alphabetical coldfusion-8

1
推荐指数
1
解决办法
418
查看次数

打开和阅读文件

from sys import argv

script, filename = argv

txt = open(filename)

print "Here's your file %r:" % filename
print txt.read()
Run Code Online (Sandbox Code Playgroud)

当我运行此代码时,使用文本文件的名称作为参数'ex15_sample.txt',然后它返回文本文档中的内容.

但是,当我将最后一行更改为:

print txt
Run Code Online (Sandbox Code Playgroud)

然后它会显示:

<open file 'ex15_sample.txt', mode 'r' at 0x004A6230>
Run Code Online (Sandbox Code Playgroud)

我不确定区别是什么,因为txt变量应该打开文件.我知道该read命令读取文件,但在文档中,它说open一个文件对象返回,我不知道这意味着什么.

python file-io python-2.7

1
推荐指数
1
解决办法
154
查看次数

CF8 - 循环求和

我有一个问题:

<cfquery name="getDesc" datasource="#ds#">
  SELECT
    desc,
    SUM(charge) as cost,
    COUNT(*) as cnt
  FROM
    product
  WHERE Length(desc) > 0
</cfquery>
Run Code Online (Sandbox Code Playgroud)

然后填充表格:

<table>
  <tbody>
      <tr>
        <th>Description</th>
        <th>Amount of Charges</th>
        <th>Cost (&pound;)</th>
      </tr>

      <cfoutput query="getDesc">
      <tr>
        <td>
          #HTMLEditFormat(getDesc.desc)# <br />
        </td>     
        <td>
          #HTMLEditFormat(getDesc.cnt)# <br />
        </td>
        <td>
            #HTMLEditFormat(getDesc.cost)# <br />
        </td>
      </tr>
    </cfoutput>
  </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

我的问题是,我想组合两行具有相同值的表,并将它们的两个计数加在一起.

到目前为止,我有:

<table>
  <tbody>
      <tr>
        <th>Description</th>
        <th>Amount of Charges</th>
        <th>Cost (&pound;)</th>
      </tr>

      <cfoutput query="getDesc">
      <tr>
        <cfif getDesc.desc EQ 'No Charge' OR getDesc.desc EQ 'No Charge (2)'>
          <td>
            No …
Run Code Online (Sandbox Code Playgroud)

mysql coldfusion loops addition coldfusion-8

0
推荐指数
1
解决办法
105
查看次数