首页 \ 问答 \ 获取所选ColdFusion单选按钮的ID(非值)(Get ID (not value) of selected ColdFusion radio button)

获取所选ColdFusion单选按钮的ID(非值)(Get ID (not value) of selected ColdFusion radio button)

我在ColdFusion中创建了一个测验,一个表中有问题,另一个表中有答案; 它是多种选择,每个答案都是作为一个广播组的成员呈现的。 我正在遍历我的记录集rsAnswers,以输出无线电组。 我需要为Insert操作获取所选单选按钮的数据库ID,但无法弄明白。

这是我输出问题和答案的方式:

<h3>Question #<cfoutput>#Session.theQuestion#</cfoutput></h3>
<h3><cfoutput>#rsQuestion.rrqQuestion#</cfoutput></h3>
<ol type="A" id="answerList">
  <cfoutput query="rsAnswers">
    <li>
      <label>
        <input type="radio" name="theAnswers" id=#rsAnswers.ID#" value="#rsAnswers.rraValue#" />
        #rsAnswers.rraAnswer#</label>
    </li>
  </cfoutput>
</ol>

如果我可以检索所选单选按钮的ID属性,我会没事的,但我没有看到在CF中这样做的方法。 我错过了什么?

TIA - 乔


I've created a quiz in ColdFusion with questions in one table and answers in another; it's multiple choice and each answer is presented as a member of a radio group. I'm looping through my recordset, rsAnswers, to output the radio group. I need to get the database ID of the selected radio button for an Insert operation and can't figure it out.

Here's how I'm outputting the question and answers:

<h3>Question #<cfoutput>#Session.theQuestion#</cfoutput></h3>
<h3><cfoutput>#rsQuestion.rrqQuestion#</cfoutput></h3>
<ol type="A" id="answerList">
  <cfoutput query="rsAnswers">
    <li>
      <label>
        <input type="radio" name="theAnswers" id=#rsAnswers.ID#" value="#rsAnswers.rraValue#" />
        #rsAnswers.rraAnswer#</label>
    </li>
  </cfoutput>
</ol>

If I could retrieve the ID attribute of the selected radio button, I'd be fine, but I don't see a way to do that in CF. What am I missing?

TIA - Joe


原文:https://stackoverflow.com/questions/32280897
更新时间:2022-04-01 13:04

最满意答案

对于nls您必须更仔细地指定参数。 此外,您可能不想使用log(y) ,因为这将绘制对数而不是y 。 我的猜测是你想使用y ~ exp(a + b * x) 。 请参阅下面的示例。

ggplot(df, aes(x = t, y = m))+
  geom_point()+
  geom_smooth(method = "nls", formula = y  ~ exp(a + b * x), start=list(a=0, b=1), se=FALSE)

你也可以使用glm而不是nls 。 例如,以下内容为您提供相同的解决方案。

ggplot(df, aes(x = t, y = m))+
  geom_point()+
  geom_smooth(method = "glm", formula = y  ~ x, family=gaussian(link = "log"), se=FALSE)

For nls you have to specify the parameters more carefully. Also, you probably don't want to use log(y), because that will plot the logarithm instead of y. My guess is that you want to use something like y ~ exp(a + b * x). See below for an example.

ggplot(df, aes(x = t, y = m))+
  geom_point()+
  geom_smooth(method = "nls", formula = y  ~ exp(a + b * x), start=list(a=0, b=1), se=FALSE)

You could also use glm instead of nls. For instance the following gives you the same solution.

ggplot(df, aes(x = t, y = m))+
  geom_point()+
  geom_smooth(method = "glm", formula = y  ~ x, family=gaussian(link = "log"), se=FALSE)

相关问答

更多
  • 对于nls您必须更仔细地指定参数。 此外,您可能不想使用log(y) ,因为这将绘制对数而不是y 。 我的猜测是你想使用y ~ exp(a + b * x) 。 请参阅下面的示例。 ggplot(df, aes(x = t, y = m))+ geom_point()+ geom_smooth(method = "nls", formula = y ~ exp(a + b * x), start=list(a=0, b=1), se=FALSE) 你也可以使用glm而不是nls 。 例如,以下内 ...
  • 有几个问题: formula是nls一个参数,你需要传递一个公式对象给它,而不是一个字符。 ggplot2将y和x传递给nls而不是fold和t 。 默认情况下, stat_smooth尝试获取置信区间。 这在predict.nls没有实现。 综上所述: d <- ggplot(test,aes(x=t, y=fold))+ #to make it obvious I use argument names instead of positional matching geom_poi ...
  • 出现错误是因为没有任何名为“date”和“ratio”的变量。 这很好用: library(ggplot2) df <- as.data.frame(read.table("unemp.txt", header = TRUE, colClasses = c("Date", "numeric"))) names(df) <- c("date", "ratio") p <- ggplot(df,aes(x=date,y=ratio)) p + geom_point() + geom_smooth() + xl ...
  • 我的问题是:使用这种结构,是否可以从该调用中拉出实际的nls对象? 我想知道我的系数等。 这在ggplot2中目前是不可能的。 ggplot2函数从模型返回预测,但不返回模型对象本身。 因此,您无法从ggplot对象中提取nls对象以查找系数等。 ggplot2和ggplot2-dev邮件列表中有两个相关的讨论: https://groups.google.com/d/topic/ggplot2/7tiUB2sjCxM/discussion https://groups.google.com/d/topic ...
  • f1和这里都没有任何参数,因此在理解如何优化f1一些困难并不令人惊讶。 nls2::nls2 (如stats::nls )需要一个formula作为第一个参数。 该公式可以从任何你想要的功能构建而成,并且不必在通话中完全写下来。 您可以执行以下操作: a <- function(d){ d+1 } f1 <- function(b,d,x){ y <- a(d)*x/(b+x) } 然后适合这样的模型: nls2(y~f1(b,d,x), start = st, algorithm = "bru ...
  • 您在帖子中链接的答案是在3年前发布的, ggplot2 , ggplot2许多内容自此以后发生了变化。 那时, ggplot2版本0.9.0尚未发布。 根据absoluteGrob的1.0.0文档 ,它仍然是实验性的,这意味着它在链接答案时肯定是实验性的。 此时,它很可能从ggplot2名称空间导出,因此可供用户使用。 这就是为什么链接的答案在当时起作用的原因。 但是,从版本1.0.1开始,它不会从ggplot2名称空间导出。 因此,虽然您可以使用ggplot2:::absoluteGrob (适用于非导出 ...
  • 问题很简单,但追踪它确实是一项艰巨的任务。 stat=identity应该是stat="identity" 。 我也改变了fill=treatment以获得以下图片: ggplot(summary.2, aes(x=genotype, y=height, fill=treatment)) + geom_bar(position=position_dodge(), stat="identity", colour="black") + geom_errorbar(aes(ymin=height ...
  • 我相信,当您使用响应的自然对数变换拟合模型时,您只需要允许单独的斜率和截距适合您的分组变量Factor 。 我称之为单独的线条模型。 然后,您可以预测并获得每个Factor对数标度上的置信度(或预测)间隔,并进行反向变换以查看线条(非常类似于ggplot2原始帖子中的ggplot2 。 R中单独的线模型示例: fit1 = lm(y ~ time*Factor, data = x) summary(fit1) 该模型的输出将显示Factor的参考水平的估计截距,参考水平的估计斜率,以及参考水平和所有其他水 ...
  • 理想的解决方案是使用ggplot绘制nls()的结果,但这是基于一些观察的“快速而肮脏”的解决方案。 首先,您可以确定如果对nls()和geom_smooth(method = "nls")使用相同的公式,您将获得相同的系数。 那是因为后者正在呼唤前者。 其次,使用您的示例数据,无论起始值如何, nls()收敛到相同的Vmax和Km值(每种药物都不同)。 换句话说,没有必要使用每种药物的范围内的起始值来构建模型。 以下任何一项对药物1给出相同的结果(对于药物2也是如此): library(dplyr) # ...
  • 你想从aes调用中删除df$ : p <- ggplot(df,aes(timestamp,power))+theme_bw() +geom_point() 这是因为aes 的作用范围 You want to remove the df$ from inside the aes call: p <- ggplot(df,aes(timestamp,power))+theme_bw() +geom_point() This is because of how aes is scoped

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)